From a8e8e3149ee21692a92dcf079c0882c036030041 Mon Sep 17 00:00:00 2001 From: Zaki Shaikh Date: Tue, 12 Nov 2024 15:01:01 +0530 Subject: [PATCH] Configure E2E test setup on PAC for bitbucket server configured e2e test for bitbucket server on PAC and wrote one test for pull request. https://issues.redhat.com/browse/SRVKP-6758 Signed-off-by: Zaki Shaikh --- .github/workflows/kind-e2e-tests.yaml | 5 +- go.mod | 2 + go.sum | 3 + hack/gh-workflow-ci.sh | 9 + test/bitbucket_server_pull_request_test.go | 53 + test/pkg/bitbucketserver/api.go | 70 + test/pkg/bitbucketserver/crd.go | 69 + test/pkg/bitbucketserver/pr.go | 82 + test/pkg/bitbucketserver/setup.go | 92 + vendor/github.com/antihax/optional/LICENSE | 8 + vendor/github.com/antihax/optional/bool.go | 36 + vendor/github.com/antihax/optional/byte.go | 36 + .../github.com/antihax/optional/complex128.go | 36 + .../github.com/antihax/optional/complex64.go | 36 + vendor/github.com/antihax/optional/float32.go | 36 + vendor/github.com/antihax/optional/float64.go | 36 + vendor/github.com/antihax/optional/int.go | 36 + vendor/github.com/antihax/optional/int16.go | 36 + vendor/github.com/antihax/optional/int32.go | 36 + vendor/github.com/antihax/optional/int64.go | 36 + vendor/github.com/antihax/optional/int8.go | 36 + .../github.com/antihax/optional/interface.go | 37 + vendor/github.com/antihax/optional/rune.go | 36 + vendor/github.com/antihax/optional/string.go | 36 + vendor/github.com/antihax/optional/time.go | 38 + vendor/github.com/antihax/optional/uint.go | 36 + vendor/github.com/antihax/optional/uint16.go | 36 + vendor/github.com/antihax/optional/uint32.go | 36 + vendor/github.com/antihax/optional/uint64.go | 36 + vendor/github.com/antihax/optional/uint8.go | 36 + vendor/github.com/antihax/optional/uintptr.go | 36 + .../gdasson/bitbucketv1go/.gitignore | 24 + .../bitbucketv1go/.swagger-codegen-ignore | 23 + .../gdasson/bitbucketv1go/.travis.yml | 8 + .../github.com/gdasson/bitbucketv1go/LICENSE | 21 + .../gdasson/bitbucketv1go/README.md | 873 ++ .../bitbucketv1go/api_authentication.go | 3773 ++++++ .../api_builds_and_deployments.go | 2360 ++++ .../gdasson/bitbucketv1go/api_capabilities.go | 184 + .../gdasson/bitbucketv1go/api_dashboard.go | 292 + .../gdasson/bitbucketv1go/api_default.go | 178 + .../gdasson/bitbucketv1go/api_deprecated.go | 2661 ++++ .../bitbucketv1go/api_jira_integration.go | 429 + .../gdasson/bitbucketv1go/api_markup.go | 162 + .../bitbucketv1go/api_mirroring_mirror.go | 1790 +++ .../bitbucketv1go/api_mirroring_upstream.go | 2077 ++++ .../api_permission_management.go | 4835 ++++++++ .../gdasson/bitbucketv1go/api_project.go | 7228 +++++++++++ .../bitbucketv1go/api_pull_requests.go | 8083 ++++++++++++ .../gdasson/bitbucketv1go/api_repository.go | 10139 ++++++++++++++++ .../gdasson/bitbucketv1go/api_security.go | 3332 +++++ .../bitbucketv1go/api_system_maintenance.go | 8187 +++++++++++++ .../gdasson/bitbucketv1go/client.go | 518 + .../gdasson/bitbucketv1go/configuration.go | 71 + .../gdasson/bitbucketv1go/models.go | 5504 +++++++++ .../gdasson/bitbucketv1go/response.go | 42 + vendor/modules.txt | 6 + 57 files changed, 63951 insertions(+), 1 deletion(-) create mode 100644 test/bitbucket_server_pull_request_test.go create mode 100644 test/pkg/bitbucketserver/api.go create mode 100644 test/pkg/bitbucketserver/crd.go create mode 100644 test/pkg/bitbucketserver/pr.go create mode 100644 test/pkg/bitbucketserver/setup.go create mode 100644 vendor/github.com/antihax/optional/LICENSE create mode 100644 vendor/github.com/antihax/optional/bool.go create mode 100644 vendor/github.com/antihax/optional/byte.go create mode 100644 vendor/github.com/antihax/optional/complex128.go create mode 100644 vendor/github.com/antihax/optional/complex64.go create mode 100644 vendor/github.com/antihax/optional/float32.go create mode 100644 vendor/github.com/antihax/optional/float64.go create mode 100644 vendor/github.com/antihax/optional/int.go create mode 100644 vendor/github.com/antihax/optional/int16.go create mode 100644 vendor/github.com/antihax/optional/int32.go create mode 100644 vendor/github.com/antihax/optional/int64.go create mode 100644 vendor/github.com/antihax/optional/int8.go create mode 100644 vendor/github.com/antihax/optional/interface.go create mode 100644 vendor/github.com/antihax/optional/rune.go create mode 100644 vendor/github.com/antihax/optional/string.go create mode 100644 vendor/github.com/antihax/optional/time.go create mode 100644 vendor/github.com/antihax/optional/uint.go create mode 100644 vendor/github.com/antihax/optional/uint16.go create mode 100644 vendor/github.com/antihax/optional/uint32.go create mode 100644 vendor/github.com/antihax/optional/uint64.go create mode 100644 vendor/github.com/antihax/optional/uint8.go create mode 100644 vendor/github.com/antihax/optional/uintptr.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/.gitignore create mode 100644 vendor/github.com/gdasson/bitbucketv1go/.swagger-codegen-ignore create mode 100644 vendor/github.com/gdasson/bitbucketv1go/.travis.yml create mode 100644 vendor/github.com/gdasson/bitbucketv1go/LICENSE create mode 100644 vendor/github.com/gdasson/bitbucketv1go/README.md create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_authentication.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_builds_and_deployments.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_capabilities.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_dashboard.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_default.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_deprecated.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_jira_integration.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_markup.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_mirroring_mirror.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_mirroring_upstream.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_permission_management.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_project.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_pull_requests.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_repository.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_security.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/api_system_maintenance.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/client.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/configuration.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/models.go create mode 100644 vendor/github.com/gdasson/bitbucketv1go/response.go diff --git a/.github/workflows/kind-e2e-tests.yaml b/.github/workflows/kind-e2e-tests.yaml index 496a3d76e..3e970a558 100644 --- a/.github/workflows/kind-e2e-tests.yaml +++ b/.github/workflows/kind-e2e-tests.yaml @@ -84,7 +84,10 @@ jobs: "${{ secrets.INSTALLATION_ID }}" \ "${{ secrets.GH_APPS_TOKEN }}" \ "${{ secrets.TEST_GITHUB_SECOND_TOKEN }}" \ - "${{ secrets.GITLAB_TOKEN }}" + "${{ secrets.GITLAB_TOKEN }}" \ + "${{ secrets.BITBUCKET_SERVER_TOKEN }}" \ + "${{ secrets.BITBUCKET_SERVER_API_URL }}" \ + "${{ secrets.BITBUCKET_SERVER_WEBHOOK_SECRET }}" - name: Run E2E Tests on nightly if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} diff --git a/go.mod b/go.mod index b7af55b26..ec88ee5fe 100644 --- a/go.mod +++ b/go.mod @@ -8,9 +8,11 @@ require ( code.gitea.io/gitea v1.22.1 code.gitea.io/sdk/gitea v0.19.0 github.com/AlecAivazis/survey/v2 v2.3.7 + github.com/antihax/optional v1.0.0 github.com/bradleyfalzon/ghinstallation/v2 v2.11.0 github.com/cloudevents/sdk-go/v2 v2.15.2 github.com/fvbommel/sortorder v1.1.0 + github.com/gdasson/bitbucketv1go v1.0.0 github.com/gfleury/go-bitbucket-v1 v0.0.0-20240822132758-a3031aa024b4 github.com/gobwas/glob v0.2.3 github.com/google/cel-go v0.21.0 diff --git a/go.sum b/go.sum index 021e2a694..830cfc701 100644 --- a/go.sum +++ b/go.sum @@ -630,6 +630,7 @@ github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8V github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 h1:yL7+Jz0jTC6yykIK/Wh74gnTJnrGr5AyrNMXuA0gves= github.com/antlr/antlr4/runtime/Go/antlr v1.4.10/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= @@ -730,6 +731,8 @@ github.com/fvbommel/sortorder v1.1.0 h1:fUmoe+HLsBTctBDoaBwpQo5N+nrCp8g/BjKb/6ZQ github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= +github.com/gdasson/bitbucketv1go v1.0.0 h1:sRiO7XgqY4WaolHruzPufPLRODfSUGUVkWLDHy4Ba5M= +github.com/gdasson/bitbucketv1go v1.0.0/go.mod h1:VKmMS4gxRLRBKoyzNVYc7P+crDC7/UQ97+mVc6OqE34= github.com/gfleury/go-bitbucket-v1 v0.0.0-20240822132758-a3031aa024b4 h1:sRZ/hpZOEfU+/05QFOt6nRE+OAFWCP0x+qz+inrcbkw= github.com/gfleury/go-bitbucket-v1 v0.0.0-20240822132758-a3031aa024b4/go.mod h1:bB7XwdZF40tLVnu9n5A9TjI2ddNZtLYImtwYwmcmnRo= github.com/gfleury/go-bitbucket-v1/test/bb-mock-server v0.0.0-20230825095122-9bc1711434ab h1:BeG9dDWckFi/p5Gvqq3wTEDXsUV4G6bdvjEHMOT2B8E= diff --git a/hack/gh-workflow-ci.sh b/hack/gh-workflow-ci.sh index 459f53bc5..767a7310b 100755 --- a/hack/gh-workflow-ci.sh +++ b/hack/gh-workflow-ci.sh @@ -71,6 +71,9 @@ run_e2e_tests() { gh_apps_token="${5}" test_github_second_token="${6}" gitlab_token="${7}" + bitbucket_server_token="${8}" + bitbucket_server_api_url="${9}" + bitbucket_server_webhook_secret="${10}" # Nothing specific to webhook here it just that repo is private in that org and that's what we want to test export TEST_GITHUB_PRIVATE_TASK_URL="https://github.com/openshift-pipelines/pipelines-as-code-e2e-tests-private/blob/main/remote_task.yaml" @@ -112,6 +115,12 @@ run_e2e_tests() { export TEST_GITLAB_PROJECT_ID="34405323" export TEST_GITLAB_TOKEN=${gitlab_token} # https://gitlab.com/gitlab-com/alliances/ibm-red-hat/sandbox/openshift-pipelines/pac-e2e-tests + + export TEST_BITBUCKET_SERVER_TOKEN=${bitbucket_server_token} + export TEST_BITBUCKET_SERVER_API_URL=${bitbucket_server_api_url} + export TEST_BITBUCKET_SERVER_WEBHOOK_SECRET=${bitbucket_server_webhook_secret} + export TEST_BITBUCKET_SERVER_USER="pipelines" + export TEST_BITBUCKET_SERVER_E2E_REPOSITORY="PAC/pac-e2e-tests" make test-e2e } diff --git a/test/bitbucket_server_pull_request_test.go b/test/bitbucket_server_pull_request_test.go new file mode 100644 index 000000000..d6e371fb0 --- /dev/null +++ b/test/bitbucket_server_pull_request_test.go @@ -0,0 +1,53 @@ +//go:build e2e +// +build e2e + +package test + +import ( + "context" + "fmt" + "testing" + + "github.com/openshift-pipelines/pipelines-as-code/pkg/params/triggertype" + tbbs "github.com/openshift-pipelines/pipelines-as-code/test/pkg/bitbucketserver" + "github.com/openshift-pipelines/pipelines-as-code/test/pkg/wait" + + "github.com/tektoncd/pipeline/pkg/names" + "gotest.tools/v3/assert" +) + +func TestBitbucketServerPullRequest(t *testing.T) { + targetNS := names.SimpleNameGenerator.RestrictLengthWithRandomSuffix("pac-e2e-ns") + ctx := context.Background() + + ctx, runcnx, opts, provider, restClient, err := tbbs.Setup(ctx) + assert.NilError(t, err) + + repo := tbbs.CreateCRD(ctx, t, provider, runcnx, opts, targetNS) + defer tbbs.TearDownNs(ctx, t, runcnx, targetNS) + + title := "TestPullRequest - " + targetNS + numberOfFiles := 5 + files := map[string]string{} + for i := range numberOfFiles { + files[fmt.Sprintf("pipelinerun-%d.yaml", i)] = "testdata/pipelinerun.yaml" + } + + pr, commits := tbbs.CreatePR(ctx, t, restClient, *repo, runcnx, opts, files, title, targetNS) + assert.Assert(t, numberOfFiles == len(commits)) + runcnx.Clients.Log.Infof("Pull Request with title '%s' is created", pr.Title) + defer tbbs.TearDownBranch(ctx, t, runcnx, provider, restClient, opts, pr.Id, targetNS) + + successOpts := wait.SuccessOpt{ + TargetNS: targetNS, + OnEvent: triggertype.PullRequest.String(), + NumberofPRMatch: 5, + Title: commits[0].Message, + MinNumberStatus: 5, + } + wait.Succeeded(ctx, t, runcnx, opts, successOpts) +} + +// Local Variables: +// compile-command: "go test -tags=e2e -v -run TestBitbucketServerPullRequest$ ." +// End: diff --git a/test/pkg/bitbucketserver/api.go b/test/pkg/bitbucketserver/api.go new file mode 100644 index 000000000..6db98ad04 --- /dev/null +++ b/test/pkg/bitbucketserver/api.go @@ -0,0 +1,70 @@ +package bitbucketserver + +import ( + "bytes" + "context" + "fmt" + "io" + "mime/multipart" + "net/http" + "os" +) + +func callAPI(ctx context.Context, endpointURL, method string, fields map[string]string) ([]byte, error) { + req, err := createRequest(ctx, endpointURL, method, fields) + if err != nil { + return nil, err + } + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + return nil, fmt.Errorf("error sending request: %w", err) + } + defer resp.Body.Close() + + if resp.StatusCode > 300 { + return nil, fmt.Errorf("error status code: %d", resp.StatusCode) + } + + responseBody, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("error reading response: %w", err) + } + + return responseBody, nil +} + +func createRequest(ctx context.Context, endpointURL, method string, fields map[string]string) (*http.Request, error) { + var requestBody bytes.Buffer + writer := multipart.NewWriter(&requestBody) + + if len(fields) > 0 { + for field, value := range fields { + err := writer.WriteField(field, value) + if err != nil { + return nil, fmt.Errorf("error writing field %s to multipart data: %w", field, err) + } + } + + err := writer.Close() + if err != nil { + return nil, fmt.Errorf("error closing writer: %w", err) + } + } + + req, err := http.NewRequestWithContext(ctx, method, endpointURL, &requestBody) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + + if len(fields) > 0 { + req.Header.Set("Content-Type", writer.FormDataContentType()) + } + + bitbucketServerUser := os.Getenv("TEST_BITBUCKET_SERVER_USER") + bitbucketServerToken := os.Getenv("TEST_BITBUCKET_SERVER_TOKEN") + req.SetBasicAuth(bitbucketServerUser, bitbucketServerToken) + + return req, nil +} diff --git a/test/pkg/bitbucketserver/crd.go b/test/pkg/bitbucketserver/crd.go new file mode 100644 index 000000000..9e655cbfa --- /dev/null +++ b/test/pkg/bitbucketserver/crd.go @@ -0,0 +1,69 @@ +package bitbucketserver + +import ( + "context" + "encoding/json" + "os" + "strings" + "testing" + + "github.com/openshift-pipelines/pipelines-as-code/pkg/apis/pipelinesascode/v1alpha1" + "github.com/openshift-pipelines/pipelines-as-code/pkg/params" + "github.com/openshift-pipelines/pipelines-as-code/pkg/provider/bitbucketserver" + "github.com/openshift-pipelines/pipelines-as-code/test/pkg/options" + pacrepo "github.com/openshift-pipelines/pipelines-as-code/test/pkg/repository" + "github.com/openshift-pipelines/pipelines-as-code/test/pkg/secret" + + bbv1 "github.com/gfleury/go-bitbucket-v1" + "gotest.tools/v3/assert" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func CreateCRD(ctx context.Context, t *testing.T, bprovider bitbucketserver.Provider, run *params.Run, opts options.E2E, targetNS string) *bbv1.Repository { + resp, err := bprovider.Client.DefaultApi.GetRepository(opts.Organization, opts.Repo) + assert.NilError(t, err) + + body, err := json.Marshal(resp.Values) + assert.NilError(t, err) + repo := &bbv1.Repository{} + err = json.Unmarshal(body, repo) + assert.NilError(t, err) + + url := strings.ReplaceAll(repo.Links.Self[0].Href, "/browse", "") + repository := &v1alpha1.Repository{ + ObjectMeta: metav1.ObjectMeta{ + Name: targetNS, + }, + Spec: v1alpha1.RepositorySpec{ + URL: url, + }, + } + + err = pacrepo.CreateNS(ctx, targetNS, run) + assert.NilError(t, err) + run.Clients.Log.Infof("Namespace %s is created", targetNS) + + token, _ := os.LookupEnv("TEST_BITBUCKET_SERVER_TOKEN") + apiURL, _ := os.LookupEnv("TEST_BITBUCKET_SERVER_API_URL") + apiUser, _ := os.LookupEnv("TEST_BITBUCKET_SERVER_USER") + webhookSecret := os.Getenv("TEST_BITBUCKET_SERVER_WEBHOOK_SECRET") + secretName := "bitbucket-server-webhook-config" + err = secret.Create(ctx, run, map[string]string{ + "provider.token": token, + "webhook.secret": webhookSecret, + }, targetNS, secretName) + assert.NilError(t, err) + run.Clients.Log.Infof("PipelinesAsCode Secret %s is created", secretName) + + repository.Spec.GitProvider = &v1alpha1.GitProvider{ + URL: apiURL, + User: apiUser, + Secret: &v1alpha1.Secret{Name: secretName}, + WebhookSecret: &v1alpha1.Secret{Name: secretName}, + } + + err = pacrepo.CreateRepo(ctx, targetNS, run, repository) + assert.NilError(t, err) + + return repo +} diff --git a/test/pkg/bitbucketserver/pr.go b/test/pkg/bitbucketserver/pr.go new file mode 100644 index 000000000..9daa1b762 --- /dev/null +++ b/test/pkg/bitbucketserver/pr.go @@ -0,0 +1,82 @@ +package bitbucketserver + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "os" + "testing" + + "github.com/openshift-pipelines/pipelines-as-code/pkg/params" + "github.com/openshift-pipelines/pipelines-as-code/pkg/params/triggertype" + "github.com/openshift-pipelines/pipelines-as-code/test/pkg/options" + "github.com/openshift-pipelines/pipelines-as-code/test/pkg/payload" + + "github.com/antihax/optional" + bbrest "github.com/gdasson/bitbucketv1go" + bbv1 "github.com/gfleury/go-bitbucket-v1" + "gotest.tools/v3/assert" +) + +func CreatePR(ctx context.Context, t *testing.T, restClient *bbrest.APIClient, repo bbv1.Repository, runcnx *params.Run, opts options.E2E, files map[string]string, title, targetNS string) (bbrest.RestPullRequest, []*bbrest.RestCommit) { + mainBranchRef := "refs/heads/main" + branchCreateRequest := bbrest.RestBranchCreateRequest{Name: targetNS, StartPoint: mainBranchRef} + branch, resp, err := restClient.RepositoryApi.CreateBranch(ctx, branchCreateRequest, opts.Organization, opts.Repo) + assert.NilError(t, err) + defer resp.Body.Close() + runcnx.Clients.Log.Infof("Branch %s is created", branch.Id) + + files, err = payload.GetEntries(files, targetNS, options.MainBranch, triggertype.PullRequest.String(), map[string]string{}) + assert.NilError(t, err) + commits, err := pushFilesToBranch(ctx, runcnx, opts, targetNS, files) + assert.NilError(t, err) + + prCreateOpts := &bbrest.PullRequestsApiCreateOpts{Body: optional.NewInterface(map[string]interface{}{ + "title": title, + "description": "Test PAC on bitbucket server", + "fromRef": bbv1.PullRequestRef{ID: branch.Id, Repository: repo}, + "toRef": bbv1.PullRequestRef{ID: mainBranchRef, Repository: repo}, + "closed": false, + })} + pr, resp, err := restClient.PullRequestsApi.Create(ctx, opts.Organization, opts.Repo, prCreateOpts) + assert.NilError(t, err) + defer resp.Body.Close() + + return pr, commits +} + +// pushFilesToBranch pushes multiple files to bitbucket server repo because +// bitbucket server doesn't support uploading multiple files in an API call. +// reference: https://community.developer.atlassian.com/t/rest-api-to-update-multiple-files/28731/2 +func pushFilesToBranch(ctx context.Context, run *params.Run, opts options.E2E, branchName string, files map[string]string) ([]*bbrest.RestCommit, error) { + if len(files) == 0 { + return nil, fmt.Errorf("no file to commit") + } + + commits := make([]*bbrest.RestCommit, 0, len(files)) + apiURL := os.Getenv("TEST_BITBUCKET_SERVER_API_URL") + for file, content := range files { + endpointURL := fmt.Sprintf("%s/api/latest/projects/%s/repos/%s/browse/.tekton/%s", apiURL, opts.Organization, opts.Repo, file) + fields := map[string]string{ + "branch": branchName, + "content": content, + "message": "test commit Signed-off-by: Zaki Shaikh ", + } + + response, err := callAPI(ctx, endpointURL, http.MethodPut, fields) + if err != nil { + return nil, err + } + + var tmpCommit bbrest.RestCommit + err = json.Unmarshal(response, &tmpCommit) + if err != nil { + return nil, fmt.Errorf("error unmarshaling response: %w", err) + } + commits = append(commits, &tmpCommit) + } + run.Clients.Log.Infof("%d files committed to branch %s", len(files), branchName) + + return commits, nil +} diff --git a/test/pkg/bitbucketserver/setup.go b/test/pkg/bitbucketserver/setup.go new file mode 100644 index 000000000..48e07528b --- /dev/null +++ b/test/pkg/bitbucketserver/setup.go @@ -0,0 +1,92 @@ +package bitbucketserver + +import ( + "context" + "fmt" + "os" + "strings" + "testing" + + "github.com/openshift-pipelines/pipelines-as-code/pkg/params" + "github.com/openshift-pipelines/pipelines-as-code/pkg/params/info" + "github.com/openshift-pipelines/pipelines-as-code/pkg/provider/bitbucketserver" + "github.com/openshift-pipelines/pipelines-as-code/test/pkg/options" + "github.com/openshift-pipelines/pipelines-as-code/test/pkg/repository" + + "github.com/antihax/optional" + bbrest "github.com/gdasson/bitbucketv1go" + "gotest.tools/v3/assert" +) + +func Setup(ctx context.Context) (context.Context, *params.Run, options.E2E, bitbucketserver.Provider, *bbrest.APIClient, error) { + bitbucketServerUser := os.Getenv("TEST_BITBUCKET_SERVER_USER") + bitbucketServerToken := os.Getenv("TEST_BITBUCKET_SERVER_TOKEN") + bitbucketWSOwner := os.Getenv("TEST_BITBUCKET_SERVER_E2E_REPOSITORY") + bitbucketServerAPIURL := os.Getenv("TEST_BITBUCKET_SERVER_API_URL") + + for _, value := range []string{ + "BITBUCKET_SERVER_USER", "BITBUCKET_SERVER_TOKEN", "BITBUCKET_SERVER_E2E_REPOSITORY", "BITBUCKET_SERVER_API_URL", "BITBUCKET_SERVER_WEBHOOK_SECRET", + } { + if env := os.Getenv("TEST_" + value); env == "" { + return ctx, nil, options.E2E{}, bitbucketserver.Provider{}, nil, fmt.Errorf("\"TEST_%s\" env variable is required, skipping", value) + } + } + + split := strings.Split(bitbucketWSOwner, "/") + + run := params.New() + if err := run.Clients.NewClients(ctx, &run.Info); err != nil { + return ctx, nil, options.E2E{}, bitbucketserver.Provider{}, nil, err + } + e2eoptions := options.E2E{ + Organization: split[0], + Repo: split[1], + } + bbs := bitbucketserver.Provider{} + event := info.NewEvent() + event.Provider = &info.Provider{ + Token: bitbucketServerToken, + URL: bitbucketServerAPIURL, + User: bitbucketServerUser, + } + if err := bbs.SetClient(ctx, nil, event, nil, nil); err != nil { + return ctx, nil, options.E2E{}, bitbucketserver.Provider{}, nil, err + } + + cfg := bbrest.NewConfiguration() + cfg.BasePath = bitbucketServerAPIURL + restClient := bbrest.NewAPIClient(cfg) + basicAuth := bbrest.BasicAuth{UserName: bitbucketServerUser, Password: bitbucketServerToken} + ctx = context.WithValue(ctx, bbrest.ContextBasicAuth, basicAuth) + return ctx, run, e2eoptions, bbs, restClient, nil +} + +func TearDownNs(ctx context.Context, t *testing.T, runcnx *params.Run, targetNS string) { + if os.Getenv("TEST_NOCLEANUP") == "true" { + runcnx.Clients.Log.Infof("Not cleaning up and closing PR since TEST_NOCLEANUP is set") + return + } + + repository.NSTearDown(ctx, t, runcnx, targetNS) +} + +func TearDownBranch(ctx context.Context, t *testing.T, runcnx *params.Run, bprovider bitbucketserver.Provider, restClient *bbrest.APIClient, opts options.E2E, prID int64, ref string) { + if os.Getenv("TEST_NOCLEANUP") == "true" { + runcnx.Clients.Log.Infof("Not cleaning up and closing PR since TEST_NOCLEANUP is set") + return + } + + if prID != -1 { + runcnx.Clients.Log.Infof("Deleting PR #%d", prID) + _, err := bprovider.Client.DefaultApi.DeletePullRequest(opts.Organization, opts.Repo, int(prID)) + assert.NilError(t, err) + } + + if ref != "" { + runcnx.Clients.Log.Infof("Deleting Branch %s", ref) + request := &bbrest.RepositoryApiDeleteBranchOpts{Body: optional.NewInterface(map[string]string{"name": ref})} + resp, err := restClient.RepositoryApi.DeleteBranch(ctx, opts.Organization, opts.Repo, request) + assert.NilError(t, err) + defer resp.Body.Close() + } +} diff --git a/vendor/github.com/antihax/optional/LICENSE b/vendor/github.com/antihax/optional/LICENSE new file mode 100644 index 000000000..19587fe47 --- /dev/null +++ b/vendor/github.com/antihax/optional/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2016 Adam Hintz + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/antihax/optional/bool.go b/vendor/github.com/antihax/optional/bool.go new file mode 100644 index 000000000..4f35ff561 --- /dev/null +++ b/vendor/github.com/antihax/optional/bool.go @@ -0,0 +1,36 @@ +package optional + +type Bool struct { + isSet bool + value bool +} + +func NewBool(value bool) Bool { + return Bool{ + true, + value, + } +} + +// EmptyBool returns a new Bool that does not have a value set. +func EmptyBool() Bool { + return Bool{ + false, + false, + } +} + +func (b Bool) IsSet() bool { + return b.isSet +} + +func (b Bool) Value() bool { + return b.value +} + +func (b Bool) Default(defaultValue bool) bool { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/byte.go b/vendor/github.com/antihax/optional/byte.go new file mode 100644 index 000000000..d22bbe8ff --- /dev/null +++ b/vendor/github.com/antihax/optional/byte.go @@ -0,0 +1,36 @@ +package optional + +type Byte struct { + isSet bool + value byte +} + +func NewByte(value byte) Byte { + return Byte{ + true, + value, + } +} + +// EmptyByte returns a new Byte that does not have a value set. +func EmptyByte() Byte { + return Byte{ + false, + 0, + } +} + +func (b Byte) IsSet() bool { + return b.isSet +} + +func (b Byte) Value() byte { + return b.value +} + +func (b Byte) Default(defaultValue byte) byte { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/complex128.go b/vendor/github.com/antihax/optional/complex128.go new file mode 100644 index 000000000..290b3f37b --- /dev/null +++ b/vendor/github.com/antihax/optional/complex128.go @@ -0,0 +1,36 @@ +package optional + +type Complex128 struct { + isSet bool + value complex128 +} + +func NewComplex128(value complex128) Complex128 { + return Complex128{ + true, + value, + } +} + +// EmptyComplex128 returns a new Complex128 that does not have a value set. +func EmptyComplex128() Complex128 { + return Complex128{ + false, + 0, + } +} + +func (i Complex128) IsSet() bool { + return i.isSet +} + +func (i Complex128) Value() complex128 { + return i.value +} + +func (i Complex128) Default(defaultValue complex128) complex128 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/complex64.go b/vendor/github.com/antihax/optional/complex64.go new file mode 100644 index 000000000..7d372d8c1 --- /dev/null +++ b/vendor/github.com/antihax/optional/complex64.go @@ -0,0 +1,36 @@ +package optional + +type Complex64 struct { + isSet bool + value complex64 +} + +func NewComplex64(value complex64) Complex64 { + return Complex64{ + true, + value, + } +} + +// EmptyComplex64 returns a new Complex64 that does not have a value set. +func EmptyComplex64() Complex64 { + return Complex64{ + false, + 0, + } +} + +func (i Complex64) IsSet() bool { + return i.isSet +} + +func (i Complex64) Value() complex64 { + return i.value +} + +func (i Complex64) Default(defaultValue complex64) complex64 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/float32.go b/vendor/github.com/antihax/optional/float32.go new file mode 100644 index 000000000..519cc5d69 --- /dev/null +++ b/vendor/github.com/antihax/optional/float32.go @@ -0,0 +1,36 @@ +package optional + +type Float32 struct { + isSet bool + value float32 +} + +func NewFloat32(value float32) Float32 { + return Float32{ + true, + value, + } +} + +// EmptyFloat32 returns a new Float32 that does not have a value set. +func EmptyFloat32() Float32 { + return Float32{ + false, + 0, + } +} + +func (i Float32) IsSet() bool { + return i.isSet +} + +func (i Float32) Value() float32 { + return i.value +} + +func (i Float32) Default(defaultValue float32) float32 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/float64.go b/vendor/github.com/antihax/optional/float64.go new file mode 100644 index 000000000..835f7058e --- /dev/null +++ b/vendor/github.com/antihax/optional/float64.go @@ -0,0 +1,36 @@ +package optional + +type Float64 struct { + isSet bool + value float64 +} + +func NewFloat64(value float64) Float64 { + return Float64{ + true, + value, + } +} + +// EmptyFloat64 returns a new Float64 that does not have a value set. +func EmptyFloat64() Float64 { + return Float64{ + false, + 0, + } +} + +func (i Float64) IsSet() bool { + return i.isSet +} + +func (i Float64) Value() float64 { + return i.value +} + +func (i Float64) Default(defaultValue float64) float64 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/int.go b/vendor/github.com/antihax/optional/int.go new file mode 100644 index 000000000..6c3e65b92 --- /dev/null +++ b/vendor/github.com/antihax/optional/int.go @@ -0,0 +1,36 @@ +package optional + +type Int struct { + isSet bool + value int +} + +func NewInt(value int) Int { + return Int{ + true, + value, + } +} + +// EmptyInt returns a new Int that does not have a value set. +func EmptyInt() Int { + return Int{ + false, + 0, + } +} + +func (i Int) IsSet() bool { + return i.isSet +} + +func (i Int) Value() int { + return i.value +} + +func (i Int) Default(defaultValue int) int { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/int16.go b/vendor/github.com/antihax/optional/int16.go new file mode 100644 index 000000000..49465b8c7 --- /dev/null +++ b/vendor/github.com/antihax/optional/int16.go @@ -0,0 +1,36 @@ +package optional + +type Int16 struct { + isSet bool + value int16 +} + +func NewInt16(value int16) Int16 { + return Int16{ + true, + value, + } +} + +// EmptyInt16 returns a new Int16 that does not have a value set. +func EmptyInt16() Int16 { + return Int16{ + false, + 0, + } +} + +func (i Int16) IsSet() bool { + return i.isSet +} + +func (i Int16) Value() int16 { + return i.value +} + +func (i Int16) Default(defaultValue int16) int16 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/int32.go b/vendor/github.com/antihax/optional/int32.go new file mode 100644 index 000000000..f3a33c78d --- /dev/null +++ b/vendor/github.com/antihax/optional/int32.go @@ -0,0 +1,36 @@ +package optional + +type Int32 struct { + isSet bool + value int32 +} + +func NewInt32(value int32) Int32 { + return Int32{ + true, + value, + } +} + +// EmptyInt32 returns a new Int32 that does not have a value set. +func EmptyInt32() Int32 { + return Int32{ + false, + 0, + } +} + +func (i Int32) IsSet() bool { + return i.isSet +} + +func (i Int32) Value() int32 { + return i.value +} + +func (i Int32) Default(defaultValue int32) int32 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/int64.go b/vendor/github.com/antihax/optional/int64.go new file mode 100644 index 000000000..d047470b7 --- /dev/null +++ b/vendor/github.com/antihax/optional/int64.go @@ -0,0 +1,36 @@ +package optional + +type Int64 struct { + isSet bool + value int64 +} + +func NewInt64(value int64) Int64 { + return Int64{ + true, + value, + } +} + +// EmptyInt64 returns a new Int64 that does not have a value set. +func EmptyInt64() Int64 { + return Int64{ + false, + 0, + } +} + +func (i Int64) IsSet() bool { + return i.isSet +} + +func (i Int64) Value() int64 { + return i.value +} + +func (i Int64) Default(defaultValue int64) int64 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/int8.go b/vendor/github.com/antihax/optional/int8.go new file mode 100644 index 000000000..2bd11bda7 --- /dev/null +++ b/vendor/github.com/antihax/optional/int8.go @@ -0,0 +1,36 @@ +package optional + +type Int8 struct { + isSet bool + value int8 +} + +func NewInt8(value int8) Int8 { + return Int8{ + true, + value, + } +} + +// EmptyInt8 returns a new Int8 that does not have a value set. +func EmptyInt8() Int8 { + return Int8{ + false, + 0, + } +} + +func (i Int8) IsSet() bool { + return i.isSet +} + +func (i Int8) Value() int8 { + return i.value +} + +func (i Int8) Default(defaultValue int8) int8 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/interface.go b/vendor/github.com/antihax/optional/interface.go new file mode 100644 index 000000000..a6f2416dd --- /dev/null +++ b/vendor/github.com/antihax/optional/interface.go @@ -0,0 +1,37 @@ +package optional + +// Optional represents a generic optional type, stored as an interface{}. +type Interface struct { + isSet bool + value interface{} +} + +func NewInterface(value interface{}) Interface { + return Interface{ + true, + value, + } +} + +// EmptyInterface returns a new Interface that does not have a value set. +func EmptyInterface() Interface { + return Interface{ + false, + nil, + } +} + +func (b Interface) IsSet() bool { + return b.isSet +} + +func (b Interface) Value() interface{} { + return b.value +} + +func (b Interface) Default(defaultValue interface{}) interface{} { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/rune.go b/vendor/github.com/antihax/optional/rune.go new file mode 100644 index 000000000..cbac81929 --- /dev/null +++ b/vendor/github.com/antihax/optional/rune.go @@ -0,0 +1,36 @@ +package optional + +type Rune struct { + isSet bool + value rune +} + +func NewRune(value rune) Rune { + return Rune{ + true, + value, + } +} + +// EmptyRune returns a new Rune that does not have a value set. +func EmptyRune() Rune { + return Rune{ + false, + 0, + } +} + +func (b Rune) IsSet() bool { + return b.isSet +} + +func (b Rune) Value() rune { + return b.value +} + +func (b Rune) Default(defaultValue rune) rune { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/string.go b/vendor/github.com/antihax/optional/string.go new file mode 100644 index 000000000..a2e5a2b44 --- /dev/null +++ b/vendor/github.com/antihax/optional/string.go @@ -0,0 +1,36 @@ +package optional + +type String struct { + isSet bool + value string +} + +func NewString(value string) String { + return String{ + true, + value, + } +} + +// EmptyString returns a new String that does not have a value set. +func EmptyString() String { + return String{ + false, + "", + } +} + +func (b String) IsSet() bool { + return b.isSet +} + +func (b String) Value() string { + return b.value +} + +func (b String) Default(defaultValue string) string { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/time.go b/vendor/github.com/antihax/optional/time.go new file mode 100644 index 000000000..a92a55aa4 --- /dev/null +++ b/vendor/github.com/antihax/optional/time.go @@ -0,0 +1,38 @@ +package optional + +import "time" + +type Time struct { + isSet bool + value time.Time +} + +func NewTime(value time.Time) Time { + return Time{ + true, + value, + } +} + +// EmptyTime returns a new Time that does not have a value set. +func EmptyTime() Time { + return Time{ + false, + time.Time{}, + } +} + +func (b Time) IsSet() bool { + return b.isSet +} + +func (b Time) Value() time.Time { + return b.value +} + +func (b Time) Default(defaultValue time.Time) time.Time { + if b.isSet { + return b.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uint.go b/vendor/github.com/antihax/optional/uint.go new file mode 100644 index 000000000..f9e53a41b --- /dev/null +++ b/vendor/github.com/antihax/optional/uint.go @@ -0,0 +1,36 @@ +package optional + +type Uint struct { + isSet bool + value uint +} + +func NewUint(value uint) Uint { + return Uint{ + true, + value, + } +} + +// EmptyUint returns a new Uint that does not have a value set. +func EmptyUint() Uint { + return Uint{ + false, + 0, + } +} + +func (i Uint) IsSet() bool { + return i.isSet +} + +func (i Uint) Value() uint { + return i.value +} + +func (i Uint) Default(defaultValue uint) uint { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uint16.go b/vendor/github.com/antihax/optional/uint16.go new file mode 100644 index 000000000..487eb673b --- /dev/null +++ b/vendor/github.com/antihax/optional/uint16.go @@ -0,0 +1,36 @@ +package optional + +type Uint16 struct { + isSet bool + value uint16 +} + +func NewUint16(value uint16) Uint16 { + return Uint16{ + true, + value, + } +} + +// EmptyUint16 returns a new Uint16 that does not have a value set. +func EmptyUint16() Uint16 { + return Uint16{ + false, + 0, + } +} + +func (i Uint16) IsSet() bool { + return i.isSet +} + +func (i Uint16) Value() uint16 { + return i.value +} + +func (i Uint16) Default(defaultValue uint16) uint16 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uint32.go b/vendor/github.com/antihax/optional/uint32.go new file mode 100644 index 000000000..0e46c8378 --- /dev/null +++ b/vendor/github.com/antihax/optional/uint32.go @@ -0,0 +1,36 @@ +package optional + +type Uint32 struct { + isSet bool + value uint32 +} + +func NewUint32(value uint32) Uint32 { + return Uint32{ + true, + value, + } +} + +// EmptyUint32 returns a new Uint32 that does not have a value set. +func EmptyUint32() Uint32 { + return Uint32{ + false, + 0, + } +} + +func (i Uint32) IsSet() bool { + return i.isSet +} + +func (i Uint32) Value() uint32 { + return i.value +} + +func (i Uint32) Default(defaultValue uint32) uint32 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uint64.go b/vendor/github.com/antihax/optional/uint64.go new file mode 100644 index 000000000..16004df34 --- /dev/null +++ b/vendor/github.com/antihax/optional/uint64.go @@ -0,0 +1,36 @@ +package optional + +type Uint64 struct { + isSet bool + value uint64 +} + +func NewUint64(value uint64) Uint64 { + return Uint64{ + true, + value, + } +} + +// EmptyUint64 returns a new Uint64 that does not have a value set. +func EmptyUint64() Uint64 { + return Uint64{ + false, + 0, + } +} + +func (i Uint64) IsSet() bool { + return i.isSet +} + +func (i Uint64) Value() uint64 { + return i.value +} + +func (i Uint64) Default(defaultValue uint64) uint64 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uint8.go b/vendor/github.com/antihax/optional/uint8.go new file mode 100644 index 000000000..469ceb53a --- /dev/null +++ b/vendor/github.com/antihax/optional/uint8.go @@ -0,0 +1,36 @@ +package optional + +type Uint8 struct { + isSet bool + value uint8 +} + +func NewUint8(value uint8) Uint8 { + return Uint8{ + true, + value, + } +} + +// EmptyUint8 returns a new Uint8 that does not have a value set. +func EmptyUint8() Uint8 { + return Uint8{ + false, + 0, + } +} + +func (i Uint8) IsSet() bool { + return i.isSet +} + +func (i Uint8) Value() uint8 { + return i.value +} + +func (i Uint8) Default(defaultValue uint8) uint8 { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/antihax/optional/uintptr.go b/vendor/github.com/antihax/optional/uintptr.go new file mode 100644 index 000000000..e7e2cabe0 --- /dev/null +++ b/vendor/github.com/antihax/optional/uintptr.go @@ -0,0 +1,36 @@ +package optional + +type Uintptr struct { + isSet bool + value uintptr +} + +func NewUintptr(value uintptr) Uintptr { + return Uintptr{ + true, + value, + } +} + +// EmptyUintptr returns a new Uintptr that does not have a value set. +func EmptyUintptr() Uintptr { + return Uintptr{ + false, + 0, + } +} + +func (i Uintptr) IsSet() bool { + return i.isSet +} + +func (i Uintptr) Value() uintptr { + return i.value +} + +func (i Uintptr) Default(defaultValue uintptr) uintptr { + if i.isSet { + return i.value + } + return defaultValue +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/.gitignore b/vendor/github.com/gdasson/bitbucketv1go/.gitignore new file mode 100644 index 000000000..daf913b1b --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/gdasson/bitbucketv1go/.swagger-codegen-ignore b/vendor/github.com/gdasson/bitbucketv1go/.swagger-codegen-ignore new file mode 100644 index 000000000..c5fa491b4 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/vendor/github.com/gdasson/bitbucketv1go/.travis.yml b/vendor/github.com/gdasson/bitbucketv1go/.travis.yml new file mode 100644 index 000000000..f5cb2ce9a --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/vendor/github.com/gdasson/bitbucketv1go/LICENSE b/vendor/github.com/gdasson/bitbucketv1go/LICENSE new file mode 100644 index 000000000..0d4464e29 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Gaurav Dasson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/gdasson/bitbucketv1go/README.md b/vendor/github.com/gdasson/bitbucketv1go/README.md new file mode 100644 index 000000000..8ed8182e2 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/README.md @@ -0,0 +1,873 @@ +# Go API client for bitbucketv1go + +This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + +## Overview +This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client. + +- API version: 8.14 +- Package version: 1.0.0 +- Build package: io.swagger.codegen.v3.generators.go.GoClientCodegen +For more information, please visit [https://jira.atlassian.com/projects/BSERV/summary](https://jira.atlassian.com/projects/BSERV/summary) + +## Installation +Put the package under your project folder and add the following in import: +```golang +import "./bitbucketv1go" +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://{baseurl}/rest* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AuthenticationApi* | [**AddForProject**](docs/AuthenticationApi.md#addforproject) | **Post** /keys/latest/projects/{projectKey}/ssh | Add project SSH key +*AuthenticationApi* | [**AddForRepository**](docs/AuthenticationApi.md#addforrepository) | **Post** /keys/latest/projects/{projectKey}/repos/{repositorySlug}/ssh | Add repository SSH key +*AuthenticationApi* | [**AddSshKey**](docs/AuthenticationApi.md#addsshkey) | **Post** /ssh/latest/keys | Add SSH key for user +*AuthenticationApi* | [**CreateAccessToken1**](docs/AuthenticationApi.md#createaccesstoken1) | **Put** /access-tokens/latest/projects/{projectKey} | Create project HTTP token +*AuthenticationApi* | [**CreateAccessToken2**](docs/AuthenticationApi.md#createaccesstoken2) | **Put** /access-tokens/latest/projects/{projectKey}/repos/{repositorySlug} | Create repository HTTP token +*AuthenticationApi* | [**CreateAccessToken3**](docs/AuthenticationApi.md#createaccesstoken3) | **Put** /access-tokens/latest/users/{userSlug} | Create personal HTTP token +*AuthenticationApi* | [**DeleteById**](docs/AuthenticationApi.md#deletebyid) | **Delete** /access-tokens/latest/projects/{projectKey}/{tokenId} | Delete a HTTP token +*AuthenticationApi* | [**DeleteById1**](docs/AuthenticationApi.md#deletebyid1) | **Delete** /access-tokens/latest/projects/{projectKey}/repos/{repositorySlug}/{tokenId} | Delete a HTTP token +*AuthenticationApi* | [**DeleteById2**](docs/AuthenticationApi.md#deletebyid2) | **Delete** /access-tokens/latest/users/{userSlug}/{tokenId} | Delete a HTTP token +*AuthenticationApi* | [**DeleteSshKey**](docs/AuthenticationApi.md#deletesshkey) | **Delete** /ssh/latest/keys/{keyId} | Remove SSH key +*AuthenticationApi* | [**DeleteSshKeys**](docs/AuthenticationApi.md#deletesshkeys) | **Delete** /ssh/latest/keys | Delete all user SSH key +*AuthenticationApi* | [**GetAllAccessTokens**](docs/AuthenticationApi.md#getallaccesstokens) | **Get** /access-tokens/latest/projects/{projectKey} | Get project HTTP tokens +*AuthenticationApi* | [**GetAllAccessTokens1**](docs/AuthenticationApi.md#getallaccesstokens1) | **Get** /access-tokens/latest/projects/{projectKey}/repos/{repositorySlug} | Get repository HTTP tokens +*AuthenticationApi* | [**GetAllAccessTokens2**](docs/AuthenticationApi.md#getallaccesstokens2) | **Get** /access-tokens/latest/users/{userSlug} | Get personal HTTP tokens +*AuthenticationApi* | [**GetById**](docs/AuthenticationApi.md#getbyid) | **Get** /access-tokens/latest/projects/{projectKey}/{tokenId} | Get HTTP token by ID +*AuthenticationApi* | [**GetById1**](docs/AuthenticationApi.md#getbyid1) | **Get** /access-tokens/latest/projects/{projectKey}/repos/{repositorySlug}/{tokenId} | Get HTTP token by ID +*AuthenticationApi* | [**GetById2**](docs/AuthenticationApi.md#getbyid2) | **Get** /access-tokens/latest/users/{userSlug}/{tokenId} | Get HTTP token by ID +*AuthenticationApi* | [**GetForProject**](docs/AuthenticationApi.md#getforproject) | **Get** /keys/latest/projects/{projectKey}/ssh/{keyId} | Get project SSH key +*AuthenticationApi* | [**GetForProjects**](docs/AuthenticationApi.md#getforprojects) | **Get** /keys/latest/ssh/{keyId}/projects | Get project SSH keys +*AuthenticationApi* | [**GetForRepositories**](docs/AuthenticationApi.md#getforrepositories) | **Get** /keys/latest/ssh/{keyId}/repos | Get repository SSH key +*AuthenticationApi* | [**GetForRepository**](docs/AuthenticationApi.md#getforrepository) | **Get** /keys/latest/projects/{projectKey}/repos/{repositorySlug}/ssh | Get repository SSH keys +*AuthenticationApi* | [**GetForRepository1**](docs/AuthenticationApi.md#getforrepository1) | **Get** /keys/latest/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId} | Get repository SSH key +*AuthenticationApi* | [**GetSshKey**](docs/AuthenticationApi.md#getsshkey) | **Get** /ssh/latest/keys/{keyId} | Get SSH key for user by keyId +*AuthenticationApi* | [**GetSshKeys**](docs/AuthenticationApi.md#getsshkeys) | **Get** /ssh/latest/keys | Get SSH keys for user +*AuthenticationApi* | [**GetSshKeysForProject**](docs/AuthenticationApi.md#getsshkeysforproject) | **Get** /keys/latest/projects/{projectKey}/ssh | Get SSH key +*AuthenticationApi* | [**RevokeForProject**](docs/AuthenticationApi.md#revokeforproject) | **Delete** /keys/latest/projects/{projectKey}/ssh/{keyId} | Revoke project SSH key +*AuthenticationApi* | [**RevokeForRepository**](docs/AuthenticationApi.md#revokeforrepository) | **Delete** /keys/latest/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId} | Revoke repository SSH key +*AuthenticationApi* | [**RevokeMany**](docs/AuthenticationApi.md#revokemany) | **Delete** /keys/latest/ssh/{keyId} | Revoke project SSH key +*AuthenticationApi* | [**SshSettings**](docs/AuthenticationApi.md#sshsettings) | **Get** /ssh/latest/settings | Get SSH settings +*AuthenticationApi* | [**UpdateAccessToken**](docs/AuthenticationApi.md#updateaccesstoken) | **Post** /access-tokens/latest/projects/{projectKey}/{tokenId} | Update HTTP token +*AuthenticationApi* | [**UpdateAccessToken1**](docs/AuthenticationApi.md#updateaccesstoken1) | **Post** /access-tokens/latest/projects/{projectKey}/repos/{repositorySlug}/{tokenId} | Update HTTP token +*AuthenticationApi* | [**UpdateAccessToken2**](docs/AuthenticationApi.md#updateaccesstoken2) | **Post** /access-tokens/latest/users/{userSlug}/{tokenId} | Update HTTP token +*AuthenticationApi* | [**UpdatePermission**](docs/AuthenticationApi.md#updatepermission) | **Put** /keys/latest/projects/{projectKey}/ssh/{keyId}/permission/{permission} | Update project SSH key permission +*AuthenticationApi* | [**UpdatePermission1**](docs/AuthenticationApi.md#updatepermission1) | **Put** /keys/latest/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId}/permission/{permission} | Update repository SSH key permission +*BuildsAndDeploymentsApi* | [**Add**](docs/BuildsAndDeploymentsApi.md#add) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds | Store a build status +*BuildsAndDeploymentsApi* | [**AddAnnotations**](docs/BuildsAndDeploymentsApi.md#addannotations) | **Post** /insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations | Add Code Insights annotations +*BuildsAndDeploymentsApi* | [**CreateOrUpdateDeployment**](docs/BuildsAndDeploymentsApi.md#createorupdatedeployment) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments | Create or update a deployment +*BuildsAndDeploymentsApi* | [**CreateRequiredBuildsMergeCheck**](docs/BuildsAndDeploymentsApi.md#createrequiredbuildsmergecheck) | **Post** /required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition | Create a required builds merge check +*BuildsAndDeploymentsApi* | [**Delete**](docs/BuildsAndDeploymentsApi.md#delete) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds | Delete a specific build status +*BuildsAndDeploymentsApi* | [**Delete1**](docs/BuildsAndDeploymentsApi.md#delete1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments | Delete a deployment +*BuildsAndDeploymentsApi* | [**DeleteACodeInsightsReport**](docs/BuildsAndDeploymentsApi.md#deleteacodeinsightsreport) | **Delete** /insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key} | Delete a Code Insights report +*BuildsAndDeploymentsApi* | [**DeleteAnnotations**](docs/BuildsAndDeploymentsApi.md#deleteannotations) | **Delete** /insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations | Delete Code Insights annotations +*BuildsAndDeploymentsApi* | [**DeleteRequiredBuildsMergeCheck**](docs/BuildsAndDeploymentsApi.md#deleterequiredbuildsmergecheck) | **Delete** /required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id} | Delete a required builds merge check +*BuildsAndDeploymentsApi* | [**Get**](docs/BuildsAndDeploymentsApi.md#get) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds | Get a specific build status +*BuildsAndDeploymentsApi* | [**Get1**](docs/BuildsAndDeploymentsApi.md#get1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments | Get a deployment +*BuildsAndDeploymentsApi* | [**GetACodeInsightsReport**](docs/BuildsAndDeploymentsApi.md#getacodeinsightsreport) | **Get** /insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key} | Get a Code Insights report +*BuildsAndDeploymentsApi* | [**GetAnnotations**](docs/BuildsAndDeploymentsApi.md#getannotations) | **Get** /insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations | Get Code Insights annotations for a report +*BuildsAndDeploymentsApi* | [**GetAnnotations1**](docs/BuildsAndDeploymentsApi.md#getannotations1) | **Get** /insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/annotations | Get Code Insights annotations for a commit +*BuildsAndDeploymentsApi* | [**GetBuildStatusStats**](docs/BuildsAndDeploymentsApi.md#getbuildstatusstats) | **Get** /build-status/latest/commits/stats/{commitId} | Get build status statistics for commit +*BuildsAndDeploymentsApi* | [**GetPageOfRequiredBuildsMergeChecks**](docs/BuildsAndDeploymentsApi.md#getpageofrequiredbuildsmergechecks) | **Get** /required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/conditions | Get required builds merge checks +*BuildsAndDeploymentsApi* | [**GetReports**](docs/BuildsAndDeploymentsApi.md#getreports) | **Get** /insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports | Get all Code Insights reports for a commit +*BuildsAndDeploymentsApi* | [**SetACodeInsightsReport**](docs/BuildsAndDeploymentsApi.md#setacodeinsightsreport) | **Put** /insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key} | Create a Code Insights report +*BuildsAndDeploymentsApi* | [**SetAnnotation**](docs/BuildsAndDeploymentsApi.md#setannotation) | **Put** /insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations/{externalId} | Create or replace a Code Insights annotation +*BuildsAndDeploymentsApi* | [**UpdateRequiredBuildsMergeCheck**](docs/BuildsAndDeploymentsApi.md#updaterequiredbuildsmergecheck) | **Put** /required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id} | Update a required builds merge check +*CapabilitiesApi* | [**GetCapabilities**](docs/CapabilitiesApi.md#getcapabilities) | **Get** /api/latest/build/capabilities | Get build capabilities +*CapabilitiesApi* | [**GetCapabilities1**](docs/CapabilitiesApi.md#getcapabilities1) | **Get** /api/latest/deployment/capabilities | Get deployment capabilities +*DashboardApi* | [**GetPullRequestSuggestions**](docs/DashboardApi.md#getpullrequestsuggestions) | **Get** /api/latest/dashboard/pull-request-suggestions | Get pull request suggestions +*DashboardApi* | [**GetPullRequests1**](docs/DashboardApi.md#getpullrequests1) | **Get** /api/latest/dashboard/pull-requests | Get pull requests for a user +*DefaultApi* | [**GetPullRequestCount**](docs/DefaultApi.md#getpullrequestcount) | **Get** /api/latest/inbox/pull-requests/count | Get total number of pull requests in inbox +*DefaultApi* | [**GetPullRequests2**](docs/DefaultApi.md#getpullrequests2) | **Get** /api/latest/inbox/pull-requests | Get pull requests in inbox +*DeprecatedApi* | [**AddBuildStatus**](docs/DeprecatedApi.md#addbuildstatus) | **Post** /build-status/latest/commits/{commitId} | Create build status for commit +*DeprecatedApi* | [**AddGroupToUser**](docs/DeprecatedApi.md#addgrouptouser) | **Post** /api/latest/admin/users/add-group | Add user to group +*DeprecatedApi* | [**AddUserToGroup**](docs/DeprecatedApi.md#addusertogroup) | **Post** /api/latest/admin/groups/add-user | Add user to group +*DeprecatedApi* | [**Approve**](docs/DeprecatedApi.md#approve) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve | Approve pull request +*DeprecatedApi* | [**CountPullRequestTasks**](docs/DeprecatedApi.md#countpullrequesttasks) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/tasks/count | Get pull request task count +*DeprecatedApi* | [**CreateTask**](docs/DeprecatedApi.md#createtask) | **Post** /api/latest/tasks | Create task +*DeprecatedApi* | [**DeleteTask**](docs/DeprecatedApi.md#deletetask) | **Delete** /api/latest/tasks/{taskId} | Delete task +*DeprecatedApi* | [**GetBuildStatus**](docs/DeprecatedApi.md#getbuildstatus) | **Get** /build-status/latest/commits/{commitId} | Get build statuses for commit +*DeprecatedApi* | [**GetBuildStatusStats**](docs/DeprecatedApi.md#getbuildstatusstats) | **Get** /build-status/latest/commits/stats/{commitId} | Get build status statistics for commit +*DeprecatedApi* | [**GetDefaultBranch1**](docs/DeprecatedApi.md#getdefaultbranch1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/branches/default | Get default branch +*DeprecatedApi* | [**GetLikers**](docs/DeprecatedApi.md#getlikers) | **Get** /comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/likes | Get comment likes +*DeprecatedApi* | [**GetLikers1**](docs/DeprecatedApi.md#getlikers1) | **Get** /comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/likes | Get pull request comment likes +*DeprecatedApi* | [**GetPullRequestTasks**](docs/DeprecatedApi.md#getpullrequesttasks) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/tasks | Get pull request tasks +*DeprecatedApi* | [**GetTask**](docs/DeprecatedApi.md#gettask) | **Get** /api/latest/tasks/{taskId} | Get task +*DeprecatedApi* | [**Like**](docs/DeprecatedApi.md#like) | **Post** /comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/likes | Like a commit comment +*DeprecatedApi* | [**Like1**](docs/DeprecatedApi.md#like1) | **Post** /comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/likes | Like a pull request comment +*DeprecatedApi* | [**OnAddonDisabled**](docs/DeprecatedApi.md#onaddondisabled) | **Post** /mirroring/latest/upstreamServers/{upstreamId}/addon/disabled | On disable of mirror addon +*DeprecatedApi* | [**OnAddonEnabled**](docs/DeprecatedApi.md#onaddonenabled) | **Post** /mirroring/latest/upstreamServers/{upstreamId}/addon/enabled | On enabled of mirror addon +*DeprecatedApi* | [**RemoveUserFromGroup**](docs/DeprecatedApi.md#removeuserfromgroup) | **Post** /api/latest/admin/groups/remove-user | Remove user from group +*DeprecatedApi* | [**SetDefaultBranch1**](docs/DeprecatedApi.md#setdefaultbranch1) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/branches/default | Update default branch +*DeprecatedApi* | [**SynchronizeRepositoryWithUpstream**](docs/DeprecatedApi.md#synchronizerepositorywithupstream) | **Post** /mirroring/latest/upstreamServers/{upstreamId}/repos/{upstreamRepoId}/synchronization | Get upstream settings +*DeprecatedApi* | [**SynchronizeWithUpstream**](docs/DeprecatedApi.md#synchronizewithupstream) | **Post** /mirroring/latest/upstreamServers/{upstreamId}/synchronization | Change upstream settings +*DeprecatedApi* | [**UnassignParticipantRole1**](docs/DeprecatedApi.md#unassignparticipantrole1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants | Unassign pull request participant +*DeprecatedApi* | [**Unlike**](docs/DeprecatedApi.md#unlike) | **Delete** /comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/likes | Unlike a commit comment +*DeprecatedApi* | [**Unlike1**](docs/DeprecatedApi.md#unlike1) | **Delete** /comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/likes | Unlike a pull request comment +*DeprecatedApi* | [**UpdateTask**](docs/DeprecatedApi.md#updatetask) | **Put** /api/latest/tasks/{taskId} | Update task +*DeprecatedApi* | [**WithdrawApproval**](docs/DeprecatedApi.md#withdrawapproval) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve | Unapprove pull request +*JiraIntegrationApi* | [**CreateIssue**](docs/JiraIntegrationApi.md#createissue) | **Post** /jira/latest/comments/{commentId}/issues | Create Jira Issue +*JiraIntegrationApi* | [**GetCommitsByIssueKey**](docs/JiraIntegrationApi.md#getcommitsbyissuekey) | **Get** /jira/latest/issues/{issueKey}/commits | Get changesets for issue key +*JiraIntegrationApi* | [**GetEnhancedEntityLinkForProject**](docs/JiraIntegrationApi.md#getenhancedentitylinkforproject) | **Get** /jira/latest/projects/{projectKey}/primary-enhanced-entitylink | Get entity link +*JiraIntegrationApi* | [**GetIssueKeysForPullRequest**](docs/JiraIntegrationApi.md#getissuekeysforpullrequest) | **Get** /jira/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/issues | Get issues for a pull request +*MarkupApi* | [**Preview**](docs/MarkupApi.md#preview) | **Post** /api/latest/markup/preview | Preview markdown render +*MirroringMirrorApi* | [**GetFarmNodes**](docs/MirroringMirrorApi.md#getfarmnodes) | **Get** /mirroring/latest/upstreamServers/{upstreamId}/farmNodes | Get farm nodes +*MirroringMirrorApi* | [**GetMirrorMode**](docs/MirroringMirrorApi.md#getmirrormode) | **Get** /mirroring/latest/upstreamServers/{upstreamId}/settings/mode | Get mirror mode +*MirroringMirrorApi* | [**GetMirrorSettings**](docs/MirroringMirrorApi.md#getmirrorsettings) | **Get** /mirroring/latest/upstreamServers/{upstreamId}/settings | Get upstream settings +*MirroringMirrorApi* | [**GetMirroredProjects**](docs/MirroringMirrorApi.md#getmirroredprojects) | **Get** /mirroring/latest/upstreamServers/{upstreamId}/settings/projects | Get mirrored project IDs +*MirroringMirrorApi* | [**GetMirroredRepository**](docs/MirroringMirrorApi.md#getmirroredrepository) | **Get** /mirroring/latest/upstreamServers/{upstreamId}/repos/{upstreamRepoId} | Get clone URLs +*MirroringMirrorApi* | [**GetRefChangesQueue**](docs/MirroringMirrorApi.md#getrefchangesqueue) | **Get** /mirroring/latest/supportInfo/refChangesQueue | Get items in ref changes queue +*MirroringMirrorApi* | [**GetRefChangesQueueCount**](docs/MirroringMirrorApi.md#getrefchangesqueuecount) | **Get** /mirroring/latest/supportInfo/refChangesQueue/count | Get total number of items in ref changes queue +*MirroringMirrorApi* | [**GetRepoSyncStatus**](docs/MirroringMirrorApi.md#getreposyncstatus) | **Get** /mirroring/latest/supportInfo/repoSyncStatus | Get sync status of repositories +*MirroringMirrorApi* | [**GetSynchronizationProgress**](docs/MirroringMirrorApi.md#getsynchronizationprogress) | **Get** /mirroring/latest/upstreamServers/{upstreamId}/progress | Get synchronization progress state +*MirroringMirrorApi* | [**GetUpstreamServer**](docs/MirroringMirrorApi.md#getupstreamserver) | **Get** /mirroring/latest/upstreamServers/{upstreamId} | Get upstream server by ID +*MirroringMirrorApi* | [**ListUpstreamServers**](docs/MirroringMirrorApi.md#listupstreamservers) | **Get** /mirroring/latest/upstreamServers | Get upstream servers +*MirroringMirrorApi* | [**OnAddonDisabled**](docs/MirroringMirrorApi.md#onaddondisabled) | **Post** /mirroring/latest/upstreamServers/{upstreamId}/addon/disabled | On disable of mirror addon +*MirroringMirrorApi* | [**OnAddonEnabled**](docs/MirroringMirrorApi.md#onaddonenabled) | **Post** /mirroring/latest/upstreamServers/{upstreamId}/addon/enabled | On enabled of mirror addon +*MirroringMirrorApi* | [**SetMirrorMode**](docs/MirroringMirrorApi.md#setmirrormode) | **Put** /mirroring/latest/upstreamServers/{upstreamId}/settings/mode | Update mirror mode +*MirroringMirrorApi* | [**SetMirrorSettings**](docs/MirroringMirrorApi.md#setmirrorsettings) | **Put** /mirroring/latest/upstreamServers/{upstreamId}/settings | Update upstream settings +*MirroringMirrorApi* | [**StartMirroringProject**](docs/MirroringMirrorApi.md#startmirroringproject) | **Post** /mirroring/latest/upstreamServers/{upstreamId}/settings/projects/{projectId} | Add project to be mirrored +*MirroringMirrorApi* | [**StartMirroringProjects**](docs/MirroringMirrorApi.md#startmirroringprojects) | **Post** /mirroring/latest/upstreamServers/{upstreamId}/settings/projects | Add multiple projects to be mirrored +*MirroringMirrorApi* | [**StopMirroringProject**](docs/MirroringMirrorApi.md#stopmirroringproject) | **Delete** /mirroring/latest/upstreamServers/{upstreamId}/settings/projects/{projectId} | Stop mirroring project +*MirroringMirrorApi* | [**StopMirroringProjects**](docs/MirroringMirrorApi.md#stopmirroringprojects) | **Delete** /mirroring/latest/upstreamServers/{upstreamId}/settings/projects | Stop mirroring projects +*MirroringMirrorApi* | [**SynchronizeRepositoryWithUpstream**](docs/MirroringMirrorApi.md#synchronizerepositorywithupstream) | **Post** /mirroring/latest/upstreamServers/{upstreamId}/repos/{upstreamRepoId}/synchronization | Get upstream settings +*MirroringMirrorApi* | [**SynchronizeWithUpstream**](docs/MirroringMirrorApi.md#synchronizewithupstream) | **Post** /mirroring/latest/upstreamServers/{upstreamId}/synchronization | Change upstream settings +*MirroringUpstreamApi* | [**Accept**](docs/MirroringUpstreamApi.md#accept) | **Post** /mirroring/latest/requests/{mirroringRequestId}/accept | Accept a mirroring request +*MirroringUpstreamApi* | [**AnalyticsSettings**](docs/MirroringUpstreamApi.md#analyticssettings) | **Get** /mirroring/latest/analyticsSettings | Get analytics settings from upstream +*MirroringUpstreamApi* | [**Authenticate**](docs/MirroringUpstreamApi.md#authenticate) | **Post** /mirroring/latest/authenticate | Authenticate on behalf of a user +*MirroringUpstreamApi* | [**DeleteMirroringRequest**](docs/MirroringUpstreamApi.md#deletemirroringrequest) | **Delete** /mirroring/latest/requests/{mirroringRequestId} | Delete a mirroring request +*MirroringUpstreamApi* | [**DeletePreferredMirrorId**](docs/MirroringUpstreamApi.md#deletepreferredmirrorid) | **Delete** /mirroring/latest/account/settings/preferred-mirror | Remove preferred mirror +*MirroringUpstreamApi* | [**GetAllContentHashes**](docs/MirroringUpstreamApi.md#getallcontenthashes) | **Get** /mirroring/latest/repos | Get content hashes for repositories +*MirroringUpstreamApi* | [**GetAllReposForProject**](docs/MirroringUpstreamApi.md#getallreposforproject) | **Get** /mirroring/latest/projects/{projectId}/repos | Get hashes for repositories in project +*MirroringUpstreamApi* | [**GetContentHashById**](docs/MirroringUpstreamApi.md#getcontenthashbyid) | **Get** /mirroring/latest/repos/{repoId} | Get content hash for a repository +*MirroringUpstreamApi* | [**GetMirror**](docs/MirroringUpstreamApi.md#getmirror) | **Get** /mirroring/latest/mirrorServers/{mirrorId} | Get mirror by ID +*MirroringUpstreamApi* | [**GetMirroringRequest**](docs/MirroringUpstreamApi.md#getmirroringrequest) | **Get** /mirroring/latest/requests/{mirroringRequestId} | Get a mirroring request +*MirroringUpstreamApi* | [**GetPanelHtml**](docs/MirroringUpstreamApi.md#getpanelhtml) | **Get** /mirroring/latest/mirrorServers/{mirrorId}/webPanels/config | Get HTML for remote-connect web-panel on mirror +*MirroringUpstreamApi* | [**GetPreferredMirrorId**](docs/MirroringUpstreamApi.md#getpreferredmirrorid) | **Get** /mirroring/latest/account/settings/preferred-mirror | Get preferred mirror +*MirroringUpstreamApi* | [**GetProjectById**](docs/MirroringUpstreamApi.md#getprojectbyid) | **Get** /mirroring/latest/projects/{projectId} | Get project +*MirroringUpstreamApi* | [**GetRepositoryMirrors**](docs/MirroringUpstreamApi.md#getrepositorymirrors) | **Get** /mirroring/latest/repos/{repoId}/mirrors | Get mirrors for repository +*MirroringUpstreamApi* | [**ListMirrors**](docs/MirroringUpstreamApi.md#listmirrors) | **Get** /mirroring/latest/mirrorServers | Get all mirrors +*MirroringUpstreamApi* | [**ListRequests**](docs/MirroringUpstreamApi.md#listrequests) | **Get** /mirroring/latest/requests | Get mirroring requests +*MirroringUpstreamApi* | [**PublishEvent**](docs/MirroringUpstreamApi.md#publishevent) | **Post** /mirroring/latest/mirrorServers/{mirrorId}/events | Publish RepositoryMirrorEvent +*MirroringUpstreamApi* | [**Register**](docs/MirroringUpstreamApi.md#register) | **Post** /mirroring/latest/requests | Create a mirroring request +*MirroringUpstreamApi* | [**Reject**](docs/MirroringUpstreamApi.md#reject) | **Post** /mirroring/latest/requests/{mirroringRequestId}/reject | Reject a mirroring request +*MirroringUpstreamApi* | [**Remove**](docs/MirroringUpstreamApi.md#remove) | **Delete** /mirroring/latest/mirrorServers/{mirrorId} | Delete mirror by ID +*MirroringUpstreamApi* | [**SetPreferredMirrorId**](docs/MirroringUpstreamApi.md#setpreferredmirrorid) | **Post** /mirroring/latest/account/settings/preferred-mirror | Set preferred mirror +*MirroringUpstreamApi* | [**Upgrade**](docs/MirroringUpstreamApi.md#upgrade) | **Put** /mirroring/latest/mirrorServers/{mirrorId} | Upgrade add-on for a mirror +*PermissionManagementApi* | [**AddGroupToUser**](docs/PermissionManagementApi.md#addgrouptouser) | **Post** /api/latest/admin/users/add-group | Add user to group +*PermissionManagementApi* | [**AddUserToGroup**](docs/PermissionManagementApi.md#addusertogroup) | **Post** /api/latest/admin/groups/add-user | Add user to group +*PermissionManagementApi* | [**AddUserToGroups**](docs/PermissionManagementApi.md#addusertogroups) | **Post** /api/latest/admin/users/add-groups | Add user to groups +*PermissionManagementApi* | [**AddUsersToGroup**](docs/PermissionManagementApi.md#adduserstogroup) | **Post** /api/latest/admin/groups/add-users | Add multiple users to group +*PermissionManagementApi* | [**ClearUserCaptchaChallenge**](docs/PermissionManagementApi.md#clearusercaptchachallenge) | **Delete** /api/latest/admin/users/captcha | Clear CAPTCHA for user +*PermissionManagementApi* | [**CreateGroup**](docs/PermissionManagementApi.md#creategroup) | **Post** /api/latest/admin/groups | Create group +*PermissionManagementApi* | [**CreateUser**](docs/PermissionManagementApi.md#createuser) | **Post** /api/latest/admin/users | Create user +*PermissionManagementApi* | [**DeleteGroup**](docs/PermissionManagementApi.md#deletegroup) | **Delete** /api/latest/admin/groups | Remove group +*PermissionManagementApi* | [**DeleteUser**](docs/PermissionManagementApi.md#deleteuser) | **Delete** /api/latest/admin/users | Remove user +*PermissionManagementApi* | [**EraseUser**](docs/PermissionManagementApi.md#eraseuser) | **Post** /api/latest/admin/users/erasure | Erase user information +*PermissionManagementApi* | [**FindGroupsForUser**](docs/PermissionManagementApi.md#findgroupsforuser) | **Get** /api/latest/admin/users/more-members | Get groups for user +*PermissionManagementApi* | [**FindOtherGroupsForUser**](docs/PermissionManagementApi.md#findothergroupsforuser) | **Get** /api/latest/admin/users/more-non-members | Find other groups for user +*PermissionManagementApi* | [**FindUsersInGroup**](docs/PermissionManagementApi.md#findusersingroup) | **Get** /api/latest/admin/groups/more-members | Get group members +*PermissionManagementApi* | [**FindUsersNotInGroup**](docs/PermissionManagementApi.md#findusersnotingroup) | **Get** /api/latest/admin/groups/more-non-members | Get members not in group +*PermissionManagementApi* | [**GetGroups**](docs/PermissionManagementApi.md#getgroups) | **Get** /api/latest/groups | Get group names +*PermissionManagementApi* | [**GetGroups1**](docs/PermissionManagementApi.md#getgroups1) | **Get** /api/latest/admin/groups | Get groups +*PermissionManagementApi* | [**GetGroupsWithAnyPermission**](docs/PermissionManagementApi.md#getgroupswithanypermission) | **Get** /api/latest/admin/permissions/groups | Get groups with a global permission +*PermissionManagementApi* | [**GetGroupsWithAnyPermission2**](docs/PermissionManagementApi.md#getgroupswithanypermission2) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/groups | Get groups with permission to repository +*PermissionManagementApi* | [**GetGroupsWithoutAnyPermission**](docs/PermissionManagementApi.md#getgroupswithoutanypermission) | **Get** /api/latest/admin/permissions/groups/none | Get groups with no global permission +*PermissionManagementApi* | [**GetGroupsWithoutAnyPermission2**](docs/PermissionManagementApi.md#getgroupswithoutanypermission2) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/groups/none | Get groups without repository permission +*PermissionManagementApi* | [**GetUserDirectories**](docs/PermissionManagementApi.md#getuserdirectories) | **Get** /api/latest/admin/user-directories | Get directories +*PermissionManagementApi* | [**GetUsers1**](docs/PermissionManagementApi.md#getusers1) | **Get** /api/latest/admin/users | Get users +*PermissionManagementApi* | [**GetUsersWithAnyPermission**](docs/PermissionManagementApi.md#getuserswithanypermission) | **Get** /api/latest/admin/permissions/users | Get users with a global permission +*PermissionManagementApi* | [**GetUsersWithAnyPermission2**](docs/PermissionManagementApi.md#getuserswithanypermission2) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/users | Get users with permission to repository +*PermissionManagementApi* | [**GetUsersWithoutAnyPermission**](docs/PermissionManagementApi.md#getuserswithoutanypermission) | **Get** /api/latest/admin/permissions/users/none | Get users with no global permission +*PermissionManagementApi* | [**GetUsersWithoutPermission1**](docs/PermissionManagementApi.md#getuserswithoutpermission1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/users/none | Get users without repository permission +*PermissionManagementApi* | [**RemoveGroupFromUser**](docs/PermissionManagementApi.md#removegroupfromuser) | **Post** /api/latest/admin/users/remove-group | Remove user from group +*PermissionManagementApi* | [**RemoveUserFromGroup**](docs/PermissionManagementApi.md#removeuserfromgroup) | **Post** /api/latest/admin/groups/remove-user | Remove user from group +*PermissionManagementApi* | [**RenameUser**](docs/PermissionManagementApi.md#renameuser) | **Post** /api/latest/admin/users/rename | Rename user +*PermissionManagementApi* | [**RevokePermissions1**](docs/PermissionManagementApi.md#revokepermissions1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions | Revoke all repository permissions for users and groups +*PermissionManagementApi* | [**RevokePermissionsForGroup**](docs/PermissionManagementApi.md#revokepermissionsforgroup) | **Delete** /api/latest/admin/permissions/groups | Revoke all global permissions for group +*PermissionManagementApi* | [**RevokePermissionsForGroup2**](docs/PermissionManagementApi.md#revokepermissionsforgroup2) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/groups | Revoke group repository permission +*PermissionManagementApi* | [**RevokePermissionsForUser**](docs/PermissionManagementApi.md#revokepermissionsforuser) | **Delete** /api/latest/admin/permissions/users | Revoke all global permissions for user +*PermissionManagementApi* | [**RevokePermissionsForUser2**](docs/PermissionManagementApi.md#revokepermissionsforuser2) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/users | Revoke user repository permission +*PermissionManagementApi* | [**SearchPermissions1**](docs/PermissionManagementApi.md#searchpermissions1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/search | Search repository permissions +*PermissionManagementApi* | [**SetPermissionForGroup**](docs/PermissionManagementApi.md#setpermissionforgroup) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/groups | Update group repository permission +*PermissionManagementApi* | [**SetPermissionForGroups**](docs/PermissionManagementApi.md#setpermissionforgroups) | **Put** /api/latest/admin/permissions/groups | Update global permission for group +*PermissionManagementApi* | [**SetPermissionForUser**](docs/PermissionManagementApi.md#setpermissionforuser) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/users | Update user repository permission +*PermissionManagementApi* | [**SetPermissionForUsers**](docs/PermissionManagementApi.md#setpermissionforusers) | **Put** /api/latest/admin/permissions/users | Update global permission for user +*PermissionManagementApi* | [**UpdateUserDetails**](docs/PermissionManagementApi.md#updateuserdetails) | **Put** /api/latest/admin/users | Update user details +*PermissionManagementApi* | [**UpdateUserPassword**](docs/PermissionManagementApi.md#updateuserpassword) | **Put** /api/latest/admin/users/credentials | Set password for user +*PermissionManagementApi* | [**ValidateErasable**](docs/PermissionManagementApi.md#validateerasable) | **Get** /api/latest/admin/users/erasure | Check user removal +*ProjectApi* | [**Create3**](docs/ProjectApi.md#create3) | **Post** /api/latest/projects/{projectKey}/settings-restriction | Enforce project restriction +*ProjectApi* | [**CreateProject**](docs/ProjectApi.md#createproject) | **Post** /api/latest/projects | Create a new project +*ProjectApi* | [**CreateRepository**](docs/ProjectApi.md#createrepository) | **Post** /api/latest/projects/{projectKey}/repos | Create repository +*ProjectApi* | [**CreateRestrictions**](docs/ProjectApi.md#createrestrictions) | **Post** /branch-permissions/latest/projects/{projectKey}/restrictions | Create multiple ref restrictions +*ProjectApi* | [**CreateWebhook**](docs/ProjectApi.md#createwebhook) | **Post** /api/latest/projects/{projectKey}/webhooks | Create webhook +*ProjectApi* | [**Delete7**](docs/ProjectApi.md#delete7) | **Delete** /api/latest/projects/{projectKey}/settings-restriction | Stop enforcing project restriction +*ProjectApi* | [**DeleteAutoDeclineSettings**](docs/ProjectApi.md#deleteautodeclinesettings) | **Delete** /api/latest/projects/{projectKey}/settings/auto-decline | Delete auto decline settings +*ProjectApi* | [**DeleteProject**](docs/ProjectApi.md#deleteproject) | **Delete** /api/latest/projects/{projectKey} | Delete project +*ProjectApi* | [**DeleteRepository**](docs/ProjectApi.md#deleterepository) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug} | Delete repository +*ProjectApi* | [**DeleteRestriction**](docs/ProjectApi.md#deleterestriction) | **Delete** /branch-permissions/latest/projects/{projectKey}/restrictions/{id} | Delete a ref restriction +*ProjectApi* | [**DeleteWebhook**](docs/ProjectApi.md#deletewebhook) | **Delete** /api/latest/projects/{projectKey}/webhooks/{webhookId} | Delete webhook +*ProjectApi* | [**DisableHook**](docs/ProjectApi.md#disablehook) | **Delete** /api/latest/projects/{projectKey}/settings/hooks/{hookKey}/enabled | Disable repository hook +*ProjectApi* | [**EnableHook**](docs/ProjectApi.md#enablehook) | **Put** /api/latest/projects/{projectKey}/settings/hooks/{hookKey}/enabled | Enable repository hook +*ProjectApi* | [**FindWebhooks**](docs/ProjectApi.md#findwebhooks) | **Get** /api/latest/projects/{projectKey}/webhooks | Find webhooks +*ProjectApi* | [**ForkRepository**](docs/ProjectApi.md#forkrepository) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug} | Fork repository +*ProjectApi* | [**Get5**](docs/ProjectApi.md#get5) | **Get** /api/latest/projects/{projectKey}/settings-restriction | Get enforcing project setting +*ProjectApi* | [**GetAll**](docs/ProjectApi.md#getall) | **Get** /api/latest/projects/{projectKey}/settings-restriction/all | Get all enforcing project settings +*ProjectApi* | [**GetAutoDeclineSettings**](docs/ProjectApi.md#getautodeclinesettings) | **Get** /api/latest/projects/{projectKey}/settings/auto-decline | Get auto decline settings +*ProjectApi* | [**GetAvatar**](docs/ProjectApi.md#getavatar) | **Get** /api/latest/hooks/{hookKey}/avatar | Get project avatar +*ProjectApi* | [**GetConfigurations**](docs/ProjectApi.md#getconfigurations) | **Get** /api/latest/projects/{projectKey}/hook-scripts | Get configured hook scripts +*ProjectApi* | [**GetDefaultBranch2**](docs/ProjectApi.md#getdefaultbranch2) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/default-branch | Get repository default branch +*ProjectApi* | [**GetForkedRepositories**](docs/ProjectApi.md#getforkedrepositories) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/forks | Get repository forks +*ProjectApi* | [**GetGroupsWithAnyPermission1**](docs/ProjectApi.md#getgroupswithanypermission1) | **Get** /api/latest/projects/{projectKey}/permissions/groups | Get groups with permission to project +*ProjectApi* | [**GetGroupsWithoutAnyPermission1**](docs/ProjectApi.md#getgroupswithoutanypermission1) | **Get** /api/latest/projects/{projectKey}/permissions/groups/none | Get groups without project permission +*ProjectApi* | [**GetLatestInvocation**](docs/ProjectApi.md#getlatestinvocation) | **Get** /api/latest/projects/{projectKey}/webhooks/{webhookId}/latest | Get last webhook invocation details +*ProjectApi* | [**GetProject**](docs/ProjectApi.md#getproject) | **Get** /api/latest/projects/{projectKey} | Get a project +*ProjectApi* | [**GetProjectAvatar**](docs/ProjectApi.md#getprojectavatar) | **Get** /api/latest/projects/{projectKey}/avatar.png | Get avatar for project +*ProjectApi* | [**GetProjects**](docs/ProjectApi.md#getprojects) | **Get** /api/latest/projects | Get projects +*ProjectApi* | [**GetPullRequestSettings**](docs/ProjectApi.md#getpullrequestsettings) | **Get** /api/latest/projects/{projectKey}/settings/pull-requests/{scmId} | Get merge strategy +*ProjectApi* | [**GetRelatedRepositories**](docs/ProjectApi.md#getrelatedrepositories) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/related | Get related repository +*ProjectApi* | [**GetRepositories**](docs/ProjectApi.md#getrepositories) | **Get** /api/latest/projects/{projectKey}/repos | Get repositories for project +*ProjectApi* | [**GetRepository**](docs/ProjectApi.md#getrepository) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug} | Get repository +*ProjectApi* | [**GetRepositoryHook**](docs/ProjectApi.md#getrepositoryhook) | **Get** /api/latest/projects/{projectKey}/settings/hooks/{hookKey} | Get a repository hook +*ProjectApi* | [**GetRepositoryHooks**](docs/ProjectApi.md#getrepositoryhooks) | **Get** /api/latest/projects/{projectKey}/settings/hooks | Get repository hooks +*ProjectApi* | [**GetRestriction**](docs/ProjectApi.md#getrestriction) | **Get** /branch-permissions/latest/projects/{projectKey}/restrictions/{id} | Get a ref restriction +*ProjectApi* | [**GetRestrictions**](docs/ProjectApi.md#getrestrictions) | **Get** /branch-permissions/latest/projects/{projectKey}/restrictions | Search for ref restrictions +*ProjectApi* | [**GetSettings**](docs/ProjectApi.md#getsettings) | **Get** /api/latest/projects/{projectKey}/settings/hooks/{hookKey}/settings | Get repository hook settings +*ProjectApi* | [**GetUsersWithAnyPermission1**](docs/ProjectApi.md#getuserswithanypermission1) | **Get** /api/latest/projects/{projectKey}/permissions/users | Get users with permission to project +*ProjectApi* | [**GetUsersWithoutPermission**](docs/ProjectApi.md#getuserswithoutpermission) | **Get** /api/latest/projects/{projectKey}/permissions/users/none | Get users without project permission +*ProjectApi* | [**GetWebhook**](docs/ProjectApi.md#getwebhook) | **Get** /api/latest/projects/{projectKey}/webhooks/{webhookId} | Get webhook +*ProjectApi* | [**HasAllUserPermission**](docs/ProjectApi.md#hasalluserpermission) | **Get** /api/latest/projects/{projectKey}/permissions/{permission}/all | Check default project permission +*ProjectApi* | [**ModifyAllUserPermission**](docs/ProjectApi.md#modifyalluserpermission) | **Post** /api/latest/projects/{projectKey}/permissions/{permission}/all | Grant project permission +*ProjectApi* | [**RemoveConfiguration**](docs/ProjectApi.md#removeconfiguration) | **Delete** /api/latest/projects/{projectKey}/hook-scripts/{scriptId} | Remove a hook script +*ProjectApi* | [**RetryCreateRepository**](docs/ProjectApi.md#retrycreaterepository) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/recreate | Retry repository creation +*ProjectApi* | [**RevokePermissions**](docs/ProjectApi.md#revokepermissions) | **Delete** /api/latest/projects/{projectKey}/permissions | Revoke project permissions +*ProjectApi* | [**RevokePermissionsForGroup1**](docs/ProjectApi.md#revokepermissionsforgroup1) | **Delete** /api/latest/projects/{projectKey}/permissions/groups | Revoke group project permission +*ProjectApi* | [**RevokePermissionsForUser1**](docs/ProjectApi.md#revokepermissionsforuser1) | **Delete** /api/latest/projects/{projectKey}/permissions/users | Revoke user project permission +*ProjectApi* | [**SearchPermissions**](docs/ProjectApi.md#searchpermissions) | **Get** /api/latest/projects/{projectKey}/permissions/search | Search project permissions +*ProjectApi* | [**SetAutoDeclineSettings**](docs/ProjectApi.md#setautodeclinesettings) | **Put** /api/latest/projects/{projectKey}/settings/auto-decline | Create/Update auto decline settings +*ProjectApi* | [**SetConfiguration**](docs/ProjectApi.md#setconfiguration) | **Put** /api/latest/projects/{projectKey}/hook-scripts/{scriptId} | Create/update a hook script +*ProjectApi* | [**SetDefaultBranch2**](docs/ProjectApi.md#setdefaultbranch2) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/default-branch | Update default branch for repository +*ProjectApi* | [**SetPermissionForGroups1**](docs/ProjectApi.md#setpermissionforgroups1) | **Put** /api/latest/projects/{projectKey}/permissions/groups | Update group project permission +*ProjectApi* | [**SetPermissionForUsers1**](docs/ProjectApi.md#setpermissionforusers1) | **Put** /api/latest/projects/{projectKey}/permissions/users | Update user project permission +*ProjectApi* | [**SetSettings**](docs/ProjectApi.md#setsettings) | **Put** /api/latest/projects/{projectKey}/settings/hooks/{hookKey}/settings | Update repository hook settings +*ProjectApi* | [**StreamContributing**](docs/ProjectApi.md#streamcontributing) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/contributing | Get repository contributing guidelines +*ProjectApi* | [**StreamLicense**](docs/ProjectApi.md#streamlicense) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/license | Get repository license +*ProjectApi* | [**StreamReadme**](docs/ProjectApi.md#streamreadme) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/readme | Get repository readme +*ProjectApi* | [**UpdateProject**](docs/ProjectApi.md#updateproject) | **Put** /api/latest/projects/{projectKey} | Update project +*ProjectApi* | [**UpdatePullRequestSettings**](docs/ProjectApi.md#updatepullrequestsettings) | **Post** /api/latest/projects/{projectKey}/settings/pull-requests/{scmId} | Update merge strategy +*ProjectApi* | [**UpdateRepository**](docs/ProjectApi.md#updaterepository) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug} | Update repository +*ProjectApi* | [**UpdateWebhook**](docs/ProjectApi.md#updatewebhook) | **Put** /api/latest/projects/{projectKey}/webhooks/{webhookId} | Update webhook +*ProjectApi* | [**UploadAvatar**](docs/ProjectApi.md#uploadavatar) | **Post** /api/latest/projects/{projectKey}/avatar.png | Update project avatar +*PullRequestsApi* | [**ApplySuggestion**](docs/PullRequestsApi.md#applysuggestion) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/apply-suggestion | Apply pull request suggestion +*PullRequestsApi* | [**Approve**](docs/PullRequestsApi.md#approve) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve | Approve pull request +*PullRequestsApi* | [**AssignParticipantRole**](docs/PullRequestsApi.md#assignparticipantrole) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants | Assign pull request participant role +*PullRequestsApi* | [**CanMerge**](docs/PullRequestsApi.md#canmerge) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge | Test if pull request can be merged +*PullRequestsApi* | [**CanRebase**](docs/PullRequestsApi.md#canrebase) | **Get** /git/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/rebase | Check PR rebase precondition +*PullRequestsApi* | [**Create**](docs/PullRequestsApi.md#create) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests | Create pull request +*PullRequestsApi* | [**Create1**](docs/PullRequestsApi.md#create1) | **Post** /api/latest/projects/{projectKey}/settings/reviewer-groups | Create reviewer group +*PullRequestsApi* | [**Create2**](docs/PullRequestsApi.md#create2) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups | Create reviewer group +*PullRequestsApi* | [**CreateComment1**](docs/PullRequestsApi.md#createcomment1) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments | Add new blocker comment +*PullRequestsApi* | [**CreateComment2**](docs/PullRequestsApi.md#createcomment2) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments | Add pull request comment +*PullRequestsApi* | [**CreatePullRequestCondition**](docs/PullRequestsApi.md#createpullrequestcondition) | **Post** /default-reviewers/latest/projects/{projectKey}/condition | Create default reviewer +*PullRequestsApi* | [**CreatePullRequestCondition1**](docs/PullRequestsApi.md#createpullrequestcondition1) | **Post** /default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/condition | Create default reviewers condition +*PullRequestsApi* | [**Decline**](docs/PullRequestsApi.md#decline) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/decline | Decline pull request +*PullRequestsApi* | [**Delete3**](docs/PullRequestsApi.md#delete3) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId} | Delete pull request +*PullRequestsApi* | [**Delete4**](docs/PullRequestsApi.md#delete4) | **Delete** /api/latest/projects/{projectKey}/settings/reviewer-groups/{id} | Delete reviewer group +*PullRequestsApi* | [**Delete5**](docs/PullRequestsApi.md#delete5) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups/{id} | Delete reviewer group +*PullRequestsApi* | [**DeleteComment1**](docs/PullRequestsApi.md#deletecomment1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments/{commentId} | Delete pull request comment +*PullRequestsApi* | [**DeleteComment2**](docs/PullRequestsApi.md#deletecomment2) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} | Delete a pull request comment +*PullRequestsApi* | [**DeletePullRequestCondition**](docs/PullRequestsApi.md#deletepullrequestcondition) | **Delete** /default-reviewers/latest/projects/{projectKey}/condition/{id} | Remove default reviewer +*PullRequestsApi* | [**DeletePullRequestCondition1**](docs/PullRequestsApi.md#deletepullrequestcondition1) | **Delete** /default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id} | Delete a default reviewer condition +*PullRequestsApi* | [**DiscardReview**](docs/PullRequestsApi.md#discardreview) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/review | Discard pull request review +*PullRequestsApi* | [**FinishReview**](docs/PullRequestsApi.md#finishreview) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/review | Complete pull request review +*PullRequestsApi* | [**Get3**](docs/PullRequestsApi.md#get3) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId} | Get pull request +*PullRequestsApi* | [**GetActivities**](docs/PullRequestsApi.md#getactivities) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/activities | Get pull request activity +*PullRequestsApi* | [**GetComment1**](docs/PullRequestsApi.md#getcomment1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments/{commentId} | Get pull request comment +*PullRequestsApi* | [**GetComment2**](docs/PullRequestsApi.md#getcomment2) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} | Get a pull request comment +*PullRequestsApi* | [**GetComments1**](docs/PullRequestsApi.md#getcomments1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments | Search pull request comments +*PullRequestsApi* | [**GetComments2**](docs/PullRequestsApi.md#getcomments2) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments | Get pull request comments for path +*PullRequestsApi* | [**GetCommitMessageSuggestion**](docs/PullRequestsApi.md#getcommitmessagesuggestion) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/commit-message-suggestion | Get commit message suggestion +*PullRequestsApi* | [**GetCommits1**](docs/PullRequestsApi.md#getcommits1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/commits | Get pull request commits +*PullRequestsApi* | [**GetMergeConfig**](docs/PullRequestsApi.md#getmergeconfig) | **Get** /api/latest/admin/pull-requests/{scmId} | Get merge strategies +*PullRequestsApi* | [**GetPage**](docs/PullRequestsApi.md#getpage) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests | Get pull requests for repository +*PullRequestsApi* | [**GetPullRequestConditions**](docs/PullRequestsApi.md#getpullrequestconditions) | **Get** /default-reviewers/latest/projects/{projectKey}/conditions | Get default reviewers +*PullRequestsApi* | [**GetPullRequestConditions1**](docs/PullRequestsApi.md#getpullrequestconditions1) | **Get** /default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/conditions | Get configured default reviewers +*PullRequestsApi* | [**GetPullRequests**](docs/PullRequestsApi.md#getpullrequests) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/pull-requests | Get repository pull requests containing commit +*PullRequestsApi* | [**GetReview**](docs/PullRequestsApi.md#getreview) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/review | Get pull request comment thread +*PullRequestsApi* | [**GetReviewerGroup**](docs/PullRequestsApi.md#getreviewergroup) | **Get** /api/latest/projects/{projectKey}/settings/reviewer-groups/{id} | Get reviewer group +*PullRequestsApi* | [**GetReviewerGroup1**](docs/PullRequestsApi.md#getreviewergroup1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups/{id} | Get reviewer group +*PullRequestsApi* | [**GetReviewerGroups**](docs/PullRequestsApi.md#getreviewergroups) | **Get** /api/latest/projects/{projectKey}/settings/reviewer-groups | Get all reviewer groups +*PullRequestsApi* | [**GetReviewerGroups1**](docs/PullRequestsApi.md#getreviewergroups1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups | Get all reviewer groups +*PullRequestsApi* | [**GetReviewers**](docs/PullRequestsApi.md#getreviewers) | **Get** /default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/reviewers | Get required reviewers for PR creation +*PullRequestsApi* | [**GetUsers**](docs/PullRequestsApi.md#getusers) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups/{id}/users | Get reviewer group users +*PullRequestsApi* | [**ListParticipants**](docs/PullRequestsApi.md#listparticipants) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants | Get pull request participants +*PullRequestsApi* | [**Merge**](docs/PullRequestsApi.md#merge) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge | Merge pull request +*PullRequestsApi* | [**React1**](docs/PullRequestsApi.md#react1) | **Put** /comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/reactions/{emoticon} | React to a PR comment +*PullRequestsApi* | [**Rebase**](docs/PullRequestsApi.md#rebase) | **Post** /git/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/rebase | Rebase pull request +*PullRequestsApi* | [**Reopen**](docs/PullRequestsApi.md#reopen) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/reopen | Re-open pull request +*PullRequestsApi* | [**Search**](docs/PullRequestsApi.md#search) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/participants | Search pull request participants +*PullRequestsApi* | [**SetMergeConfig**](docs/PullRequestsApi.md#setmergeconfig) | **Post** /api/latest/admin/pull-requests/{scmId} | Update merge strategies +*PullRequestsApi* | [**StreamChanges1**](docs/PullRequestsApi.md#streamchanges1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/changes | Gets pull request changes +*PullRequestsApi* | [**StreamDiff2**](docs/PullRequestsApi.md#streamdiff2) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/diff/{path} | Stream a diff within a pull request +*PullRequestsApi* | [**StreamPatch1**](docs/PullRequestsApi.md#streampatch1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}.patch | Stream pull request as patch +*PullRequestsApi* | [**StreamRawDiff2**](docs/PullRequestsApi.md#streamrawdiff2) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}.diff | Stream raw pull request diff +*PullRequestsApi* | [**UnReact1**](docs/PullRequestsApi.md#unreact1) | **Delete** /comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/reactions/{emoticon} | Remove a reaction from a PR comment +*PullRequestsApi* | [**UnassignParticipantRole**](docs/PullRequestsApi.md#unassignparticipantrole) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} | Unassign pull request participant +*PullRequestsApi* | [**UnassignParticipantRole1**](docs/PullRequestsApi.md#unassignparticipantrole1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants | Unassign pull request participant +*PullRequestsApi* | [**Unwatch1**](docs/PullRequestsApi.md#unwatch1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/watch | Stop watching pull request +*PullRequestsApi* | [**Update**](docs/PullRequestsApi.md#update) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId} | Update pull request metadata +*PullRequestsApi* | [**Update1**](docs/PullRequestsApi.md#update1) | **Put** /api/latest/projects/{projectKey}/settings/reviewer-groups/{id} | Update reviewer group attributes +*PullRequestsApi* | [**Update2**](docs/PullRequestsApi.md#update2) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups/{id} | Update reviewer group attributes +*PullRequestsApi* | [**UpdateComment1**](docs/PullRequestsApi.md#updatecomment1) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments/{commentId} | Update pull request comment +*PullRequestsApi* | [**UpdateComment2**](docs/PullRequestsApi.md#updatecomment2) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} | Update pull request comment +*PullRequestsApi* | [**UpdatePullRequestCondition**](docs/PullRequestsApi.md#updatepullrequestcondition) | **Put** /default-reviewers/latest/projects/{projectKey}/condition/{id} | Update the default reviewer +*PullRequestsApi* | [**UpdatePullRequestCondition1**](docs/PullRequestsApi.md#updatepullrequestcondition1) | **Put** /default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id} | Update a default reviewer condition +*PullRequestsApi* | [**UpdateStatus**](docs/PullRequestsApi.md#updatestatus) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} | Change pull request status +*PullRequestsApi* | [**Watch1**](docs/PullRequestsApi.md#watch1) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/watch | Watch pull request +*PullRequestsApi* | [**WithdrawApproval**](docs/PullRequestsApi.md#withdrawapproval) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve | Unapprove pull request +*RepositoryApi* | [**AddLabel**](docs/RepositoryApi.md#addlabel) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/labels | Add repository label +*RepositoryApi* | [**CreateBranch**](docs/RepositoryApi.md#createbranch) | **Post** /branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches | Create branch +*RepositoryApi* | [**CreateBranchForRepository**](docs/RepositoryApi.md#createbranchforrepository) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/branches | Create branch +*RepositoryApi* | [**CreateComment**](docs/RepositoryApi.md#createcomment) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments | Add a new commit comment +*RepositoryApi* | [**CreateRestrictions1**](docs/RepositoryApi.md#createrestrictions1) | **Post** /branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions | Create multiple ref restrictions +*RepositoryApi* | [**CreateTag**](docs/RepositoryApi.md#createtag) | **Post** /git/latest/projects/{projectKey}/repos/{repositorySlug}/tags | Create tag +*RepositoryApi* | [**CreateTagForRepository**](docs/RepositoryApi.md#createtagforrepository) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/tags | Create tag +*RepositoryApi* | [**CreateWebhook1**](docs/RepositoryApi.md#createwebhook1) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks | Create webhook +*RepositoryApi* | [**DeleteAttachment**](docs/RepositoryApi.md#deleteattachment) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId} | Delete an attachment +*RepositoryApi* | [**DeleteAttachmentMetadata**](docs/RepositoryApi.md#deleteattachmentmetadata) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata | Delete attachment metadata +*RepositoryApi* | [**DeleteAutoDeclineSettings1**](docs/RepositoryApi.md#deleteautodeclinesettings1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline | Delete auto decline settings +*RepositoryApi* | [**DeleteBranch**](docs/RepositoryApi.md#deletebranch) | **Delete** /branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches | Delete branch +*RepositoryApi* | [**DeleteComment**](docs/RepositoryApi.md#deletecomment) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId} | Delete a commit comment +*RepositoryApi* | [**DeleteRepositoryHook**](docs/RepositoryApi.md#deleterepositoryhook) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey} | Delete repository hook +*RepositoryApi* | [**DeleteRestriction1**](docs/RepositoryApi.md#deleterestriction1) | **Delete** /branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id} | Delete a ref restriction +*RepositoryApi* | [**DeleteTag**](docs/RepositoryApi.md#deletetag) | **Delete** /git/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name} | Delete tag +*RepositoryApi* | [**DeleteWebhook1**](docs/RepositoryApi.md#deletewebhook1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId} | Delete webhook +*RepositoryApi* | [**DisableHook1**](docs/RepositoryApi.md#disablehook1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled | Disable repository hook +*RepositoryApi* | [**EditFile**](docs/RepositoryApi.md#editfile) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path} | Edit file +*RepositoryApi* | [**EnableHook1**](docs/RepositoryApi.md#enablehook1) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled | Enable repository hook +*RepositoryApi* | [**FindBranches**](docs/RepositoryApi.md#findbranches) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities/branches | Get branches with ref change activities for repository +*RepositoryApi* | [**FindByCommit**](docs/RepositoryApi.md#findbycommit) | **Get** /branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches/info/{commitId} | Get branch +*RepositoryApi* | [**FindWebhooks1**](docs/RepositoryApi.md#findwebhooks1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks | Find webhooks +*RepositoryApi* | [**GetAllLabelsForRepository**](docs/RepositoryApi.md#getalllabelsforrepository) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/labels | Get repository labels +*RepositoryApi* | [**GetArchive**](docs/RepositoryApi.md#getarchive) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/archive | Stream archive of repository +*RepositoryApi* | [**GetAttachment**](docs/RepositoryApi.md#getattachment) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId} | Get an attachment +*RepositoryApi* | [**GetAttachmentMetadata**](docs/RepositoryApi.md#getattachmentmetadata) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata | Get attachment metadata +*RepositoryApi* | [**GetAutoDeclineSettings1**](docs/RepositoryApi.md#getautodeclinesettings1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline | Get auto decline settings +*RepositoryApi* | [**GetBranches**](docs/RepositoryApi.md#getbranches) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/branches | Find branches +*RepositoryApi* | [**GetChanges**](docs/RepositoryApi.md#getchanges) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/changes | Get changes in commit +*RepositoryApi* | [**GetChanges1**](docs/RepositoryApi.md#getchanges1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/changes | Get changes made in commit +*RepositoryApi* | [**GetComment**](docs/RepositoryApi.md#getcomment) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId} | Get a commit comment +*RepositoryApi* | [**GetComments**](docs/RepositoryApi.md#getcomments) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments | Search for commit comments +*RepositoryApi* | [**GetCommit**](docs/RepositoryApi.md#getcommit) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId} | Get commit by ID +*RepositoryApi* | [**GetCommits**](docs/RepositoryApi.md#getcommits) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits | Get commits +*RepositoryApi* | [**GetConfigurations1**](docs/RepositoryApi.md#getconfigurations1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts | Get hook scripts +*RepositoryApi* | [**GetContent**](docs/RepositoryApi.md#getcontent) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/browse | Get file content at revision +*RepositoryApi* | [**GetContent1**](docs/RepositoryApi.md#getcontent1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path} | Get file content +*RepositoryApi* | [**GetDefaultBranch1**](docs/RepositoryApi.md#getdefaultbranch1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/branches/default | Get default branch +*RepositoryApi* | [**GetLatestInvocation1**](docs/RepositoryApi.md#getlatestinvocation1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/latest | Get last webhook invocation details +*RepositoryApi* | [**GetPullRequestSettings1**](docs/RepositoryApi.md#getpullrequestsettings1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests | Get pull request settings +*RepositoryApi* | [**GetRefChangeActivity**](docs/RepositoryApi.md#getrefchangeactivity) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities | Get ref change activity +*RepositoryApi* | [**GetRepositories1**](docs/RepositoryApi.md#getrepositories1) | **Get** /api/latest/repos | Search for repositories +*RepositoryApi* | [**GetRepositoriesRecentlyAccessed**](docs/RepositoryApi.md#getrepositoriesrecentlyaccessed) | **Get** /api/latest/profile/recent/repos | Get recently accessed repositories +*RepositoryApi* | [**GetRepositoryHook1**](docs/RepositoryApi.md#getrepositoryhook1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey} | Get repository hook +*RepositoryApi* | [**GetRepositoryHooks1**](docs/RepositoryApi.md#getrepositoryhooks1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks | Get repository hooks +*RepositoryApi* | [**GetRestriction1**](docs/RepositoryApi.md#getrestriction1) | **Get** /branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id} | Get a ref restriction +*RepositoryApi* | [**GetRestrictions1**](docs/RepositoryApi.md#getrestrictions1) | **Get** /branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions | Search for ref restrictions +*RepositoryApi* | [**GetSettings1**](docs/RepositoryApi.md#getsettings1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings | Get repository hook settings +*RepositoryApi* | [**GetStatus**](docs/RepositoryApi.md#getstatus) | **Get** /sync/latest/projects/{projectKey}/repos/{repositorySlug} | Get synchronization status +*RepositoryApi* | [**GetTag**](docs/RepositoryApi.md#gettag) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name} | Get tag +*RepositoryApi* | [**GetTags**](docs/RepositoryApi.md#gettags) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/tags | Find tag +*RepositoryApi* | [**GetWebhook1**](docs/RepositoryApi.md#getwebhook1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId} | Get webhook +*RepositoryApi* | [**React**](docs/RepositoryApi.md#react) | **Put** /comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon} | React to a comment +*RepositoryApi* | [**RemoveConfiguration1**](docs/RepositoryApi.md#removeconfiguration1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId} | Remove a hook script +*RepositoryApi* | [**RemoveLabel**](docs/RepositoryApi.md#removelabel) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/labels/{labelName} | Remove repository label +*RepositoryApi* | [**SaveAttachmentMetadata**](docs/RepositoryApi.md#saveattachmentmetadata) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata | Save attachment metadata +*RepositoryApi* | [**SearchWebhooks**](docs/RepositoryApi.md#searchwebhooks) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/search | Search webhooks +*RepositoryApi* | [**SetAutoDeclineSettings1**](docs/RepositoryApi.md#setautodeclinesettings1) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline | Create auto decline settings +*RepositoryApi* | [**SetConfiguration1**](docs/RepositoryApi.md#setconfiguration1) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId} | Create/update a hook script +*RepositoryApi* | [**SetDefaultBranch1**](docs/RepositoryApi.md#setdefaultbranch1) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/branches/default | Update default branch +*RepositoryApi* | [**SetEnabled**](docs/RepositoryApi.md#setenabled) | **Post** /sync/latest/projects/{projectKey}/repos/{repositorySlug} | Disable synchronization +*RepositoryApi* | [**SetSettings1**](docs/RepositoryApi.md#setsettings1) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings | Update repository hook settings +*RepositoryApi* | [**Stream**](docs/RepositoryApi.md#stream) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified | Stream files +*RepositoryApi* | [**Stream1**](docs/RepositoryApi.md#stream1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified/{path} | Stream files with last modified commit in path +*RepositoryApi* | [**StreamChanges**](docs/RepositoryApi.md#streamchanges) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/changes | Compare commits +*RepositoryApi* | [**StreamCommits**](docs/RepositoryApi.md#streamcommits) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/commits | Get accessible commits +*RepositoryApi* | [**StreamDiff**](docs/RepositoryApi.md#streamdiff) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff/{path} | Get diff between revisions +*RepositoryApi* | [**StreamDiff1**](docs/RepositoryApi.md#streamdiff1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff{path} | Get diff between commits +*RepositoryApi* | [**StreamFiles**](docs/RepositoryApi.md#streamfiles) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/files/{path} | Get files in directory +*RepositoryApi* | [**StreamFiles1**](docs/RepositoryApi.md#streamfiles1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/files | Get files in directory +*RepositoryApi* | [**StreamPatch**](docs/RepositoryApi.md#streampatch) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/patch | Get patch content at revision +*RepositoryApi* | [**StreamRaw**](docs/RepositoryApi.md#streamraw) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/raw/{path} | Get raw content of a file at revision +*RepositoryApi* | [**StreamRawDiff**](docs/RepositoryApi.md#streamrawdiff) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/diff | Get raw diff for path +*RepositoryApi* | [**StreamRawDiff1**](docs/RepositoryApi.md#streamrawdiff1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/diff/{path} | Get raw diff for path +*RepositoryApi* | [**Synchronize**](docs/RepositoryApi.md#synchronize) | **Post** /sync/latest/projects/{projectKey}/repos/{repositorySlug}/synchronize | Manual synchronization +*RepositoryApi* | [**UnReact**](docs/RepositoryApi.md#unreact) | **Delete** /comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon} | Remove a reaction from comment +*RepositoryApi* | [**Unwatch**](docs/RepositoryApi.md#unwatch) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch | Stop watching commit +*RepositoryApi* | [**Unwatch2**](docs/RepositoryApi.md#unwatch2) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/watch | Stop watching repository +*RepositoryApi* | [**UpdateComment**](docs/RepositoryApi.md#updatecomment) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId} | Update a commit comment +*RepositoryApi* | [**UpdatePullRequestSettings1**](docs/RepositoryApi.md#updatepullrequestsettings1) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/pull-requests | Update pull request settings +*RepositoryApi* | [**UpdateWebhook1**](docs/RepositoryApi.md#updatewebhook1) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId} | Update webhook +*RepositoryApi* | [**Watch**](docs/RepositoryApi.md#watch) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch | Watch commit +*RepositoryApi* | [**Watch2**](docs/RepositoryApi.md#watch2) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/watch | Watch repository +*SecurityApi* | [**AddKey**](docs/SecurityApi.md#addkey) | **Post** /gpg/latest/keys | Create a GPG key +*SecurityApi* | [**BulkAddExemptRepositories**](docs/SecurityApi.md#bulkaddexemptrepositories) | **Post** /api/latest/secret-scanning/exempt | Bulk exempt repos from secret scanning +*SecurityApi* | [**CreateAllowlistRule**](docs/SecurityApi.md#createallowlistrule) | **Post** /api/latest/projects/{projectKey}/secret-scanning/allowlist | Create project secret scanning allowlist rule +*SecurityApi* | [**CreateAllowlistRule1**](docs/SecurityApi.md#createallowlistrule1) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist | Create repository secret scanning allowlist rule +*SecurityApi* | [**CreateRule**](docs/SecurityApi.md#createrule) | **Post** /api/latest/projects/{projectKey}/secret-scanning/rules | Create project secret scanning rule +*SecurityApi* | [**CreateRule1**](docs/SecurityApi.md#createrule1) | **Post** /api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules | Create repository secret scanning rule +*SecurityApi* | [**CreateRule2**](docs/SecurityApi.md#createrule2) | **Post** /api/latest/secret-scanning/rules | Create global secret scanning rule +*SecurityApi* | [**DeleteAllowlistRule**](docs/SecurityApi.md#deleteallowlistrule) | **Delete** /api/latest/projects/{projectKey}/secret-scanning/allowlist/{id} | Delete a project secret scanning allowlist rule +*SecurityApi* | [**DeleteAllowlistRule1**](docs/SecurityApi.md#deleteallowlistrule1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id} | Delete a repository secret scanning allowlist rule +*SecurityApi* | [**DeleteForUser**](docs/SecurityApi.md#deleteforuser) | **Delete** /gpg/latest/keys | Delete all GPG keys for user +*SecurityApi* | [**DeleteKey**](docs/SecurityApi.md#deletekey) | **Delete** /gpg/latest/keys/{fingerprintOrId} | Delete a GPG key +*SecurityApi* | [**DeleteRule**](docs/SecurityApi.md#deleterule) | **Delete** /api/latest/projects/{projectKey}/secret-scanning/rules/{id} | Delete a project secret scanning rule +*SecurityApi* | [**DeleteRule1**](docs/SecurityApi.md#deleterule1) | **Delete** /api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id} | Delete a repository secret scanning rule +*SecurityApi* | [**DeleteRule2**](docs/SecurityApi.md#deleterule2) | **Delete** /api/latest/secret-scanning/rules/{id} | Delete a global secret scanning rule +*SecurityApi* | [**EditAllowlistRule**](docs/SecurityApi.md#editallowlistrule) | **Put** /api/latest/projects/{projectKey}/secret-scanning/allowlist/{id} | Edit an existing project secret scanning allowlist rule +*SecurityApi* | [**EditAllowlistRule1**](docs/SecurityApi.md#editallowlistrule1) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id} | Edit an existing repository secret scanning allowlist rule +*SecurityApi* | [**EditRule**](docs/SecurityApi.md#editrule) | **Put** /api/latest/projects/{projectKey}/secret-scanning/rules/{id} | Edit an existing project secret scanning rule +*SecurityApi* | [**EditRule1**](docs/SecurityApi.md#editrule1) | **Put** /api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id} | Edit an existing repository secret scanning rule +*SecurityApi* | [**EditRule2**](docs/SecurityApi.md#editrule2) | **Put** /api/latest/secret-scanning/rules/{id} | Edit a global secret scanning rule. +*SecurityApi* | [**FindExemptReposByScope**](docs/SecurityApi.md#findexemptreposbyscope) | **Get** /api/latest/secret-scanning/exempt | Find all repos exempt from secret scan +*SecurityApi* | [**GetAllowlistRule**](docs/SecurityApi.md#getallowlistrule) | **Get** /api/latest/projects/{projectKey}/secret-scanning/allowlist/{id} | Get a project secret scanning allowlist rule +*SecurityApi* | [**GetAllowlistRule1**](docs/SecurityApi.md#getallowlistrule1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id} | Get a repository secret scanning allowlist rule +*SecurityApi* | [**GetKeysForUser**](docs/SecurityApi.md#getkeysforuser) | **Get** /gpg/latest/keys | Get all GPG keys +*SecurityApi* | [**GetRule**](docs/SecurityApi.md#getrule) | **Get** /api/latest/projects/{projectKey}/secret-scanning/rules/{id} | Get a project secret scanning rule +*SecurityApi* | [**GetRule1**](docs/SecurityApi.md#getrule1) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id} | Get a repository secret scanning rule +*SecurityApi* | [**GetRule2**](docs/SecurityApi.md#getrule2) | **Get** /api/latest/secret-scanning/rules/{id} | Get a global secret scanning rule +*SecurityApi* | [**Search1**](docs/SecurityApi.md#search1) | **Get** /api/latest/projects/{projectKey}/secret-scanning/rules | Find project secret scanning rules +*SecurityApi* | [**Search2**](docs/SecurityApi.md#search2) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist | Find repository secret scanning allowlist rules +*SecurityApi* | [**Search3**](docs/SecurityApi.md#search3) | **Get** /api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules | Find repository secret scanning rules +*SecurityApi* | [**Search4**](docs/SecurityApi.md#search4) | **Get** /api/latest/secret-scanning/rules | Find global secret scanning rules +*SecurityApi* | [**SearchAllowlistRule**](docs/SecurityApi.md#searchallowlistrule) | **Get** /api/latest/projects/{projectKey}/secret-scanning/allowlist | Find project secret scanning allowlist rules +*SystemMaintenanceApi* | [**CancelExportJob**](docs/SystemMaintenanceApi.md#cancelexportjob) | **Post** /api/latest/migration/exports/{jobId}/cancel | Cancel export job +*SystemMaintenanceApi* | [**CancelImportJob**](docs/SystemMaintenanceApi.md#cancelimportjob) | **Post** /api/latest/migration/imports/{jobId}/cancel | Cancel import job +*SystemMaintenanceApi* | [**CancelMeshMigrationJob**](docs/SystemMaintenanceApi.md#cancelmeshmigrationjob) | **Post** /api/latest/migration/mesh/{jobId}/cancel | Cancel Mesh migration job +*SystemMaintenanceApi* | [**ClearDefaultBranch**](docs/SystemMaintenanceApi.md#cleardefaultbranch) | **Delete** /api/latest/admin/default-branch | Clear default branch +*SystemMaintenanceApi* | [**ClearSenderAddress**](docs/SystemMaintenanceApi.md#clearsenderaddress) | **Delete** /api/latest/admin/mail-server/sender-address | Update mail configuration +*SystemMaintenanceApi* | [**Connectivity**](docs/SystemMaintenanceApi.md#connectivity) | **Get** /api/latest/admin/git/mesh/diagnostics/connectivity | Generate Mesh connectivity report +*SystemMaintenanceApi* | [**CreateHookScript**](docs/SystemMaintenanceApi.md#createhookscript) | **Post** /api/latest/hook-scripts | Create a new hook script +*SystemMaintenanceApi* | [**Delete2**](docs/SystemMaintenanceApi.md#delete2) | **Delete** /api/latest/admin/git/mesh/nodes/{id} | Delete Mesh node +*SystemMaintenanceApi* | [**Delete6**](docs/SystemMaintenanceApi.md#delete6) | **Delete** /api/latest/admin/rate-limit/settings/users/{userSlug} | Delete user specific rate limit settings +*SystemMaintenanceApi* | [**DeleteAvatar**](docs/SystemMaintenanceApi.md#deleteavatar) | **Delete** /api/latest/users/{userSlug}/avatar.png | Delete user avatar +*SystemMaintenanceApi* | [**DeleteBanner**](docs/SystemMaintenanceApi.md#deletebanner) | **Delete** /api/latest/admin/banner | Delete announcement banner +*SystemMaintenanceApi* | [**DeleteHookScript**](docs/SystemMaintenanceApi.md#deletehookscript) | **Delete** /api/latest/hook-scripts/{scriptId} | Delete a hook script. +*SystemMaintenanceApi* | [**DeleteMailConfig**](docs/SystemMaintenanceApi.md#deletemailconfig) | **Delete** /api/latest/admin/mail-server | Delete mail configuration +*SystemMaintenanceApi* | [**DismissRetentionConfigReviewNotification**](docs/SystemMaintenanceApi.md#dismissretentionconfigreviewnotification) | **Delete** /audit/latest/notification-settings/retention-config-review | Dismiss retention config notification +*SystemMaintenanceApi* | [**Get2**](docs/SystemMaintenanceApi.md#get2) | **Get** /api/latest/admin/license | Get license details +*SystemMaintenanceApi* | [**Get4**](docs/SystemMaintenanceApi.md#get4) | **Get** /api/latest/admin/rate-limit/settings/users/{userSlug} | Get user specific rate limit settings +*SystemMaintenanceApi* | [**GetActiveMeshMigrationSummary**](docs/SystemMaintenanceApi.md#getactivemeshmigrationsummary) | **Get** /api/latest/migration/mesh/summary | Get summary for Mesh migration job +*SystemMaintenanceApi* | [**GetAllMeshMigrationSummaries**](docs/SystemMaintenanceApi.md#getallmeshmigrationsummaries) | **Get** /api/latest/migration/mesh/summaries | Get all Mesh migration job summaries +*SystemMaintenanceApi* | [**GetAllRateLimitSettings**](docs/SystemMaintenanceApi.md#getallratelimitsettings) | **Get** /api/latest/admin/rate-limit/settings/users | Get rate limit settings for user +*SystemMaintenanceApi* | [**GetAllRegisteredMeshNodes**](docs/SystemMaintenanceApi.md#getallregisteredmeshnodes) | **Get** /api/latest/admin/git/mesh/nodes | Get all registered Mesh nodes +*SystemMaintenanceApi* | [**GetApplicationProperties**](docs/SystemMaintenanceApi.md#getapplicationproperties) | **Get** /api/latest/application-properties | Get application properties +*SystemMaintenanceApi* | [**GetBanner**](docs/SystemMaintenanceApi.md#getbanner) | **Get** /api/latest/admin/banner | Get announcement banner +*SystemMaintenanceApi* | [**GetControlPlanePublicKey**](docs/SystemMaintenanceApi.md#getcontrolplanepublickey) | **Get** /api/latest/admin/git/mesh/config/control-plane.pem | Get the control plane PEM +*SystemMaintenanceApi* | [**GetDefaultBranch**](docs/SystemMaintenanceApi.md#getdefaultbranch) | **Get** /api/latest/admin/default-branch | Get the default branch +*SystemMaintenanceApi* | [**GetExportJob**](docs/SystemMaintenanceApi.md#getexportjob) | **Get** /api/latest/migration/exports/{jobId} | Get export job details +*SystemMaintenanceApi* | [**GetExportJobMessages**](docs/SystemMaintenanceApi.md#getexportjobmessages) | **Get** /api/latest/migration/exports/{jobId}/messages | Get job messages +*SystemMaintenanceApi* | [**GetGlobalSettings**](docs/SystemMaintenanceApi.md#getglobalsettings) | **Get** /admin | Get global SSH key settings +*SystemMaintenanceApi* | [**GetHistory**](docs/SystemMaintenanceApi.md#gethistory) | **Get** /api/latest/admin/rate-limit/history | Get rate limit history +*SystemMaintenanceApi* | [**GetHookScript**](docs/SystemMaintenanceApi.md#gethookscript) | **Get** /api/latest/hook-scripts/{scriptId} | Get a hook script +*SystemMaintenanceApi* | [**GetImportJob**](docs/SystemMaintenanceApi.md#getimportjob) | **Get** /api/latest/migration/imports/{jobId} | Get import job status +*SystemMaintenanceApi* | [**GetImportJobMessages**](docs/SystemMaintenanceApi.md#getimportjobmessages) | **Get** /api/latest/migration/imports/{jobId}/messages | Get import job messages +*SystemMaintenanceApi* | [**GetInformation**](docs/SystemMaintenanceApi.md#getinformation) | **Get** /api/latest/admin/cluster | Get cluster node information +*SystemMaintenanceApi* | [**GetLabel**](docs/SystemMaintenanceApi.md#getlabel) | **Get** /api/latest/labels/{labelName} | Get label +*SystemMaintenanceApi* | [**GetLabelables**](docs/SystemMaintenanceApi.md#getlabelables) | **Get** /api/latest/labels/{labelName}/labeled | Get labelables for label +*SystemMaintenanceApi* | [**GetLabels**](docs/SystemMaintenanceApi.md#getlabels) | **Get** /api/latest/labels | Get all labels +*SystemMaintenanceApi* | [**GetLevel**](docs/SystemMaintenanceApi.md#getlevel) | **Get** /api/latest/logs/logger/{loggerName} | Get current log level +*SystemMaintenanceApi* | [**GetMailConfig**](docs/SystemMaintenanceApi.md#getmailconfig) | **Get** /api/latest/admin/mail-server | Get mail configuration +*SystemMaintenanceApi* | [**GetMeshMigrationJob**](docs/SystemMaintenanceApi.md#getmeshmigrationjob) | **Get** /api/latest/migration/mesh/{jobId} | Get Mesh migration job details +*SystemMaintenanceApi* | [**GetMeshMigrationJobMessages**](docs/SystemMaintenanceApi.md#getmeshmigrationjobmessages) | **Get** /api/latest/migration/mesh/{jobId}/messages | Get Mesh migration job messages +*SystemMaintenanceApi* | [**GetMeshMigrationJobSummary**](docs/SystemMaintenanceApi.md#getmeshmigrationjobsummary) | **Get** /api/latest/migration/mesh/{jobId}/summary | Get Mesh migration job summary +*SystemMaintenanceApi* | [**GetRegisteredMeshNodeById**](docs/SystemMaintenanceApi.md#getregisteredmeshnodebyid) | **Get** /api/latest/admin/git/mesh/nodes/{id} | Get Mesh node +*SystemMaintenanceApi* | [**GetRepositoryArchivePolicy**](docs/SystemMaintenanceApi.md#getrepositoryarchivepolicy) | **Get** /policies/latest/admin/repos/archive | Get repository archive policy +*SystemMaintenanceApi* | [**GetRepositoryDeletePolicy**](docs/SystemMaintenanceApi.md#getrepositorydeletepolicy) | **Get** /policies/latest/admin/repos/delete | Get repository delete policy +*SystemMaintenanceApi* | [**GetRootLevel**](docs/SystemMaintenanceApi.md#getrootlevel) | **Get** /api/latest/logs/rootLogger | Get root log level +*SystemMaintenanceApi* | [**GetSenderAddress**](docs/SystemMaintenanceApi.md#getsenderaddress) | **Get** /api/latest/admin/mail-server/sender-address | Get server mail address +*SystemMaintenanceApi* | [**GetSettings2**](docs/SystemMaintenanceApi.md#getsettings2) | **Get** /api/latest/admin/rate-limit/settings | Get rate limit settings +*SystemMaintenanceApi* | [**GetSupportZip**](docs/SystemMaintenanceApi.md#getsupportzip) | **Get** /api/latest/admin/git/mesh/support-zips/{id} | Get support zip for node +*SystemMaintenanceApi* | [**GetSupportZips**](docs/SystemMaintenanceApi.md#getsupportzips) | **Get** /api/latest/admin/git/mesh/support-zips | Get support zips for all Mesh nodes +*SystemMaintenanceApi* | [**GetSupportedKeyTypes**](docs/SystemMaintenanceApi.md#getsupportedkeytypes) | **Get** /admin/supported-key-types | Get supported SSH key algorithms and lengths +*SystemMaintenanceApi* | [**GetUser**](docs/SystemMaintenanceApi.md#getuser) | **Get** /api/latest/users/{userSlug} | Get user +*SystemMaintenanceApi* | [**GetUserSettings**](docs/SystemMaintenanceApi.md#getusersettings) | **Get** /api/latest/users/{userSlug}/settings | Get user settings +*SystemMaintenanceApi* | [**GetUsers2**](docs/SystemMaintenanceApi.md#getusers2) | **Get** /api/latest/users | Get all users +*SystemMaintenanceApi* | [**PreviewExport**](docs/SystemMaintenanceApi.md#previewexport) | **Post** /api/latest/migration/exports/preview | Preview export +*SystemMaintenanceApi* | [**PreviewMeshMigration**](docs/SystemMaintenanceApi.md#previewmeshmigration) | **Post** /api/latest/migration/mesh/preview | Preview Mesh migration +*SystemMaintenanceApi* | [**Read**](docs/SystemMaintenanceApi.md#read) | **Get** /api/latest/hook-scripts/{scriptId}/content | Get hook script content +*SystemMaintenanceApi* | [**RegisterNewMeshNode**](docs/SystemMaintenanceApi.md#registernewmeshnode) | **Post** /api/latest/admin/git/mesh/nodes | Register new Mesh node +*SystemMaintenanceApi* | [**SearchMeshMigrationRepos**](docs/SystemMaintenanceApi.md#searchmeshmigrationrepos) | **Get** /api/latest/migration/mesh/repos | Find repositories by Mesh migration state +*SystemMaintenanceApi* | [**Set**](docs/SystemMaintenanceApi.md#set) | **Post** /api/latest/admin/rate-limit/settings/users | Set rate limit settings for users +*SystemMaintenanceApi* | [**Set1**](docs/SystemMaintenanceApi.md#set1) | **Put** /api/latest/admin/rate-limit/settings/users/{userSlug} | Set rate limit settings for user +*SystemMaintenanceApi* | [**SetBanner**](docs/SystemMaintenanceApi.md#setbanner) | **Put** /api/latest/admin/banner | Update/Set announcement banner +*SystemMaintenanceApi* | [**SetDefaultBranch**](docs/SystemMaintenanceApi.md#setdefaultbranch) | **Put** /api/latest/admin/default-branch | Update/Set default branch +*SystemMaintenanceApi* | [**SetLevel**](docs/SystemMaintenanceApi.md#setlevel) | **Put** /api/latest/logs/logger/{loggerName}/{levelName} | Set log level +*SystemMaintenanceApi* | [**SetMailConfig**](docs/SystemMaintenanceApi.md#setmailconfig) | **Put** /api/latest/admin/mail-server | Update mail configuration +*SystemMaintenanceApi* | [**SetRepositoryArchivePolicy**](docs/SystemMaintenanceApi.md#setrepositoryarchivepolicy) | **Put** /policies/latest/admin/repos/archive | Update repository archive policy +*SystemMaintenanceApi* | [**SetRepositoryDeletePolicy**](docs/SystemMaintenanceApi.md#setrepositorydeletepolicy) | **Put** /policies/latest/admin/repos/delete | Update the repository delete policy +*SystemMaintenanceApi* | [**SetRootLevel**](docs/SystemMaintenanceApi.md#setrootlevel) | **Put** /api/latest/logs/rootLogger/{levelName} | Set root log level +*SystemMaintenanceApi* | [**SetSenderAddress**](docs/SystemMaintenanceApi.md#setsenderaddress) | **Put** /api/latest/admin/mail-server/sender-address | Update server mail address +*SystemMaintenanceApi* | [**SetSettings2**](docs/SystemMaintenanceApi.md#setsettings2) | **Put** /api/latest/admin/rate-limit/settings | Set rate limit +*SystemMaintenanceApi* | [**StartExport**](docs/SystemMaintenanceApi.md#startexport) | **Post** /api/latest/migration/exports | Start export job +*SystemMaintenanceApi* | [**StartImport**](docs/SystemMaintenanceApi.md#startimport) | **Post** /api/latest/migration/imports | Start import job +*SystemMaintenanceApi* | [**StartMeshMigration**](docs/SystemMaintenanceApi.md#startmeshmigration) | **Post** /api/latest/migration/mesh | Start Mesh migration job +*SystemMaintenanceApi* | [**UpdateGlobalSettings**](docs/SystemMaintenanceApi.md#updateglobalsettings) | **Put** /admin | Update global SSH key settings +*SystemMaintenanceApi* | [**UpdateHookScript**](docs/SystemMaintenanceApi.md#updatehookscript) | **Put** /api/latest/hook-scripts/{scriptId} | Update a hook script +*SystemMaintenanceApi* | [**UpdateLicense**](docs/SystemMaintenanceApi.md#updatelicense) | **Post** /api/latest/admin/license | Update license +*SystemMaintenanceApi* | [**UpdateMeshNode**](docs/SystemMaintenanceApi.md#updatemeshnode) | **Put** /api/latest/admin/git/mesh/nodes/{id} | Update Mesh node +*SystemMaintenanceApi* | [**UpdateSettings**](docs/SystemMaintenanceApi.md#updatesettings) | **Post** /api/latest/users/{userSlug}/settings | Update user settings +*SystemMaintenanceApi* | [**UpdateUserDetails1**](docs/SystemMaintenanceApi.md#updateuserdetails1) | **Put** /api/latest/users | Update user details +*SystemMaintenanceApi* | [**UpdateUserPassword1**](docs/SystemMaintenanceApi.md#updateuserpassword1) | **Put** /api/latest/users/credentials | Set password +*SystemMaintenanceApi* | [**UploadAvatar1**](docs/SystemMaintenanceApi.md#uploadavatar1) | **Post** /api/latest/users/{userSlug}/avatar.png | Update user avatar + +## Documentation For Models + + - [AdminBannerBody](docs/AdminBannerBody.md) + - [AdminDefaultbranchBody](docs/AdminDefaultbranchBody.md) + - [AdminMailserverBody](docs/AdminMailserverBody.md) + - [AdminPasswordUpdate](docs/AdminPasswordUpdate.md) + - [ApilatestmigrationmeshMaxBytesPerSecond](docs/ApilatestmigrationmeshMaxBytesPerSecond.md) + - [ApplicationId](docs/ApplicationId.md) + - [ApplicationUser](docs/ApplicationUser.md) + - [ConditionIdBody](docs/ConditionIdBody.md) + - [Context](docs/Context.md) + - [Credentials](docs/Credentials.md) + - [DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcher](docs/DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcher.md) + - [DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcherType](docs/DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcherType.md) + - [EnrichedRepository](docs/EnrichedRepository.md) + - [EnrichedRepositoryProperties](docs/EnrichedRepositoryProperties.md) + - [EntityHolderRestPullRequestAutoMergeRequest](docs/EntityHolderRestPullRequestAutoMergeRequest.md) + - [EntityHolderRestPullRequestAutoMergeRequestEntity](docs/EntityHolderRestPullRequestAutoMergeRequestEntity.md) + - [EntityHolderRestPullRequestDeclineRequest](docs/EntityHolderRestPullRequestDeclineRequest.md) + - [EntityHolderRestPullRequestDeclineRequestEntity](docs/EntityHolderRestPullRequestDeclineRequestEntity.md) + - [EntityHolderRestPullRequestReopenRequest](docs/EntityHolderRestPullRequestReopenRequest.md) + - [EntityHolderRestPullRequestReopenRequestEntity](docs/EntityHolderRestPullRequestReopenRequestEntity.md) + - [ExampleAvatarMultipartFormData](docs/ExampleAvatarMultipartFormData.md) + - [ExampleFiles](docs/ExampleFiles.md) + - [ExampleJsonLastModifiedCallback](docs/ExampleJsonLastModifiedCallback.md) + - [ExampleMultipartFormData](docs/ExampleMultipartFormData.md) + - [ExamplePostMultipartFormData](docs/ExamplePostMultipartFormData.md) + - [ExamplePreviewMigration](docs/ExamplePreviewMigration.md) + - [ExamplePutMultipartFormData](docs/ExamplePutMultipartFormData.md) + - [ExampleRequirements](docs/ExampleRequirements.md) + - [ExampleSettings](docs/ExampleSettings.md) + - [ExampleSettingsMap](docs/ExampleSettingsMap.md) + - [ExampleSocketAddress](docs/ExampleSocketAddress.md) + - [ExampleStatus](docs/ExampleStatus.md) + - [FilePart](docs/FilePart.md) + - [Group](docs/Group.md) + - [GroupAndUsers](docs/GroupAndUsers.md) + - [GroupPickerContext](docs/GroupPickerContext.md) + - [InlineResponse200](docs/InlineResponse200.md) + - [InlineResponse2001](docs/InlineResponse2001.md) + - [InlineResponse20010](docs/InlineResponse20010.md) + - [InlineResponse20011](docs/InlineResponse20011.md) + - [InlineResponse20012](docs/InlineResponse20012.md) + - [InlineResponse20013](docs/InlineResponse20013.md) + - [InlineResponse20014](docs/InlineResponse20014.md) + - [InlineResponse20015](docs/InlineResponse20015.md) + - [InlineResponse20016](docs/InlineResponse20016.md) + - [InlineResponse20017](docs/InlineResponse20017.md) + - [InlineResponse20018](docs/InlineResponse20018.md) + - [InlineResponse20019](docs/InlineResponse20019.md) + - [InlineResponse2002](docs/InlineResponse2002.md) + - [InlineResponse20020](docs/InlineResponse20020.md) + - [InlineResponse20021](docs/InlineResponse20021.md) + - [InlineResponse20022](docs/InlineResponse20022.md) + - [InlineResponse20023](docs/InlineResponse20023.md) + - [InlineResponse20024](docs/InlineResponse20024.md) + - [InlineResponse20025](docs/InlineResponse20025.md) + - [InlineResponse20026](docs/InlineResponse20026.md) + - [InlineResponse20027](docs/InlineResponse20027.md) + - [InlineResponse20028](docs/InlineResponse20028.md) + - [InlineResponse20029](docs/InlineResponse20029.md) + - [InlineResponse2003](docs/InlineResponse2003.md) + - [InlineResponse20030](docs/InlineResponse20030.md) + - [InlineResponse20031](docs/InlineResponse20031.md) + - [InlineResponse20032](docs/InlineResponse20032.md) + - [InlineResponse20033](docs/InlineResponse20033.md) + - [InlineResponse20034](docs/InlineResponse20034.md) + - [InlineResponse20035](docs/InlineResponse20035.md) + - [InlineResponse20036](docs/InlineResponse20036.md) + - [InlineResponse20037](docs/InlineResponse20037.md) + - [InlineResponse20038](docs/InlineResponse20038.md) + - [InlineResponse20039](docs/InlineResponse20039.md) + - [InlineResponse2004](docs/InlineResponse2004.md) + - [InlineResponse20040](docs/InlineResponse20040.md) + - [InlineResponse20041](docs/InlineResponse20041.md) + - [InlineResponse20042](docs/InlineResponse20042.md) + - [InlineResponse20043](docs/InlineResponse20043.md) + - [InlineResponse20044](docs/InlineResponse20044.md) + - [InlineResponse20045](docs/InlineResponse20045.md) + - [InlineResponse20046](docs/InlineResponse20046.md) + - [InlineResponse20047](docs/InlineResponse20047.md) + - [InlineResponse2005](docs/InlineResponse2005.md) + - [InlineResponse2006](docs/InlineResponse2006.md) + - [InlineResponse2007](docs/InlineResponse2007.md) + - [InlineResponse2008](docs/InlineResponse2008.md) + - [InlineResponse2009](docs/InlineResponse2009.md) + - [InlineResponse401](docs/InlineResponse401.md) + - [LatestKeysBody](docs/LatestKeysBody.md) + - [MigrationMeshBody](docs/MigrationMeshBody.md) + - [RepositoryHookDetails](docs/RepositoryHookDetails.md) + - [RestAccessToken](docs/RestAccessToken.md) + - [RestAccessTokenRequest](docs/RestAccessTokenRequest.md) + - [RestAggregateRejectCounter](docs/RestAggregateRejectCounter.md) + - [RestAnalyticsSettings](docs/RestAnalyticsSettings.md) + - [RestAnnouncementBanner](docs/RestAnnouncementBanner.md) + - [RestApplicationProperties](docs/RestApplicationProperties.md) + - [RestApplicationUser](docs/RestApplicationUser.md) + - [RestApplicationUserWithPermissions](docs/RestApplicationUserWithPermissions.md) + - [RestApplySuggestionRequest](docs/RestApplySuggestionRequest.md) + - [RestApplySuggestionRequestCommentVersion](docs/RestApplySuggestionRequestCommentVersion.md) + - [RestApplySuggestionRequestPullRequestVersion](docs/RestApplySuggestionRequestPullRequestVersion.md) + - [RestApplySuggestionRequestSuggestionIndex](docs/RestApplySuggestionRequestSuggestionIndex.md) + - [RestAttachmentMetadata](docs/RestAttachmentMetadata.md) + - [RestAuthenticationRequest](docs/RestAuthenticationRequest.md) + - [RestAutoDeclineSettings](docs/RestAutoDeclineSettings.md) + - [RestAutoDeclineSettingsRequest](docs/RestAutoDeclineSettingsRequest.md) + - [RestAutoDeclineSettingsScope](docs/RestAutoDeclineSettingsScope.md) + - [RestBearerTokenCredentials](docs/RestBearerTokenCredentials.md) + - [RestBitbucketLicense](docs/RestBitbucketLicense.md) + - [RestBitbucketLicenseStatus](docs/RestBitbucketLicenseStatus.md) + - [RestBranch](docs/RestBranch.md) + - [RestBranchCreateRequest](docs/RestBranchCreateRequest.md) + - [RestBranchDeleteRequest](docs/RestBranchDeleteRequest.md) + - [RestBuildCapabilities](docs/RestBuildCapabilities.md) + - [RestBuildStats](docs/RestBuildStats.md) + - [RestBuildStatus](docs/RestBuildStatus.md) + - [RestBuildStatusSetRequest](docs/RestBuildStatusSetRequest.md) + - [RestBuildStatusSetRequestTestResults](docs/RestBuildStatusSetRequestTestResults.md) + - [RestBuildStatusTestResults](docs/RestBuildStatusTestResults.md) + - [RestBulkAddInsightAnnotationRequest](docs/RestBulkAddInsightAnnotationRequest.md) + - [RestBulkUserRateLimitSettingsUpdateRequest](docs/RestBulkUserRateLimitSettingsUpdateRequest.md) + - [RestBulkUserRateLimitSettingsUpdateRequestSettings](docs/RestBulkUserRateLimitSettingsUpdateRequestSettings.md) + - [RestChange](docs/RestChange.md) + - [RestChangeConflict](docs/RestChangeConflict.md) + - [RestChangeConflictTheirChange](docs/RestChangeConflictTheirChange.md) + - [RestChangeset](docs/RestChangeset.md) + - [RestChangesetChanges](docs/RestChangesetChanges.md) + - [RestChangesetFromCommit](docs/RestChangesetFromCommit.md) + - [RestChangesetToCommit](docs/RestChangesetToCommit.md) + - [RestChangesetToCommitCommitter](docs/RestChangesetToCommitCommitter.md) + - [RestClusterInformation](docs/RestClusterInformation.md) + - [RestClusterInformationLocalNode](docs/RestClusterInformationLocalNode.md) + - [RestClusterNode](docs/RestClusterNode.md) + - [RestClusterNodeAddress](docs/RestClusterNodeAddress.md) + - [RestComment](docs/RestComment.md) + - [RestCommentJiraIssue](docs/RestCommentJiraIssue.md) + - [RestCommentThreadDiffAnchor](docs/RestCommentThreadDiffAnchor.md) + - [RestCommentThreadDiffAnchorPath](docs/RestCommentThreadDiffAnchorPath.md) + - [RestCommentThreadDiffAnchorPullRequest](docs/RestCommentThreadDiffAnchorPullRequest.md) + - [RestCommit](docs/RestCommit.md) + - [RestCommitMessageSuggestion](docs/RestCommitMessageSuggestion.md) + - [RestConflict](docs/RestConflict.md) + - [RestConflictChange](docs/RestConflictChange.md) + - [RestConnectivitySummary](docs/RestConnectivitySummary.md) + - [RestCreateBranchRequest](docs/RestCreateBranchRequest.md) + - [RestCreateTagRequest](docs/RestCreateTagRequest.md) + - [RestDefaultBranch](docs/RestDefaultBranch.md) + - [RestDefaultReviewersRequest](docs/RestDefaultReviewersRequest.md) + - [RestDeployment](docs/RestDeployment.md) + - [RestDeploymentEnvironment](docs/RestDeploymentEnvironment.md) + - [RestDeploymentSetRequest](docs/RestDeploymentSetRequest.md) + - [RestDetailedGroup](docs/RestDetailedGroup.md) + - [RestDetailedInvocation](docs/RestDetailedInvocation.md) + - [RestDetailedInvocationEventScope](docs/RestDetailedInvocationEventScope.md) + - [RestDetailedUser](docs/RestDetailedUser.md) + - [RestDiff](docs/RestDiff.md) + - [RestDiffHunk](docs/RestDiffHunk.md) + - [RestDiffLine](docs/RestDiffLine.md) + - [RestDiffSegment](docs/RestDiffSegment.md) + - [RestEmoticon](docs/RestEmoticon.md) + - [RestEnhancedEntityLink](docs/RestEnhancedEntityLink.md) + - [RestErasedUser](docs/RestErasedUser.md) + - [RestErrorMessage](docs/RestErrorMessage.md) + - [RestErrors](docs/RestErrors.md) + - [RestExportRequest](docs/RestExportRequest.md) + - [RestExportRequestRepositoriesRequest](docs/RestExportRequestRepositoriesRequest.md) + - [RestFarmSynchronizationRequest](docs/RestFarmSynchronizationRequest.md) + - [RestGitTagCreateRequest](docs/RestGitTagCreateRequest.md) + - [RestGpgKey](docs/RestGpgKey.md) + - [RestGpgSubKey](docs/RestGpgSubKey.md) + - [RestHookScript](docs/RestHookScript.md) + - [RestHookScriptConfig](docs/RestHookScriptConfig.md) + - [RestHookScriptConfigScript](docs/RestHookScriptConfigScript.md) + - [RestHookScriptTriggers](docs/RestHookScriptTriggers.md) + - [RestImportRequest](docs/RestImportRequest.md) + - [RestInsightAnnotation](docs/RestInsightAnnotation.md) + - [RestInsightAnnotationsResponse](docs/RestInsightAnnotationsResponse.md) + - [RestInsightReport](docs/RestInsightReport.md) + - [RestInsightReportData](docs/RestInsightReportData.md) + - [RestJiraIssue](docs/RestJiraIssue.md) + - [RestJob](docs/RestJob.md) + - [RestJobMessage](docs/RestJobMessage.md) + - [RestJobProgress](docs/RestJobProgress.md) + - [RestLabel](docs/RestLabel.md) + - [RestLabelable](docs/RestLabelable.md) + - [RestLogLevel](docs/RestLogLevel.md) + - [RestMailConfiguration](docs/RestMailConfiguration.md) + - [RestMarkup](docs/RestMarkup.md) + - [RestMeshConnectivityReport](docs/RestMeshConnectivityReport.md) + - [RestMeshMigrationRequest](docs/RestMeshMigrationRequest.md) + - [RestMeshMigrationSummary](docs/RestMeshMigrationSummary.md) + - [RestMeshNode](docs/RestMeshNode.md) + - [RestMigrationRepository](docs/RestMigrationRepository.md) + - [RestMinimalCommit](docs/RestMinimalCommit.md) + - [RestMinimalRef](docs/RestMinimalRef.md) + - [RestMirrorHashes](docs/RestMirrorHashes.md) + - [RestMirrorRepositorySynchronizationStatus](docs/RestMirrorRepositorySynchronizationStatus.md) + - [RestMirrorRepositorySynchronizationStatusHashes](docs/RestMirrorRepositorySynchronizationStatusHashes.md) + - [RestMirrorServer](docs/RestMirrorServer.md) + - [RestMirrorUpgradeRequest](docs/RestMirrorUpgradeRequest.md) + - [RestMirroredRepository](docs/RestMirroredRepository.md) + - [RestMirroredRepositoryDescriptor](docs/RestMirroredRepositoryDescriptor.md) + - [RestMirroredRepositoryDescriptorMirrorServer](docs/RestMirroredRepositoryDescriptorMirrorServer.md) + - [RestMirroringRequest](docs/RestMirroringRequest.md) + - [RestNamedLink](docs/RestNamedLink.md) + - [RestNode](docs/RestNode.md) + - [RestNodeConnectivityReport](docs/RestNodeConnectivityReport.md) + - [RestNodeConnectivityReportNode](docs/RestNodeConnectivityReportNode.md) + - [RestNodeConnectivitySummary](docs/RestNodeConnectivitySummary.md) + - [RestNodeConnectivitySummarySummary](docs/RestNodeConnectivitySummarySummary.md) + - [RestPageRestChange](docs/RestPageRestChange.md) + - [RestPath](docs/RestPath.md) + - [RestPermitted](docs/RestPermitted.md) + - [RestPermittedGroup](docs/RestPermittedGroup.md) + - [RestPermittedGroupGroup](docs/RestPermittedGroupGroup.md) + - [RestPermittedUser](docs/RestPermittedUser.md) + - [RestPerson](docs/RestPerson.md) + - [RestProgress](docs/RestProgress.md) + - [RestProject](docs/RestProject.md) + - [RestProjectSettingsRestriction](docs/RestProjectSettingsRestriction.md) + - [RestProjectSettingsRestrictionRequest](docs/RestProjectSettingsRestrictionRequest.md) + - [RestProperties](docs/RestProperties.md) + - [RestPullRequest](docs/RestPullRequest.md) + - [RestPullRequestActivity](docs/RestPullRequestActivity.md) + - [RestPullRequestAssignParticipantRoleRequest](docs/RestPullRequestAssignParticipantRoleRequest.md) + - [RestPullRequestAssignParticipantRoleRequestUser](docs/RestPullRequestAssignParticipantRoleRequestUser.md) + - [RestPullRequestAssignStatusRequest](docs/RestPullRequestAssignStatusRequest.md) + - [RestPullRequestAutoMergeRequest](docs/RestPullRequestAutoMergeRequest.md) + - [RestPullRequestCommitMessageTemplate](docs/RestPullRequestCommitMessageTemplate.md) + - [RestPullRequestCondition](docs/RestPullRequestCondition.md) + - [RestPullRequestConditionScope](docs/RestPullRequestConditionScope.md) + - [RestPullRequestDeclineRequest](docs/RestPullRequestDeclineRequest.md) + - [RestPullRequestDeleteRequest](docs/RestPullRequestDeleteRequest.md) + - [RestPullRequestFinishReviewRequest](docs/RestPullRequestFinishReviewRequest.md) + - [RestPullRequestFromRef](docs/RestPullRequestFromRef.md) + - [RestPullRequestFromRefRepository](docs/RestPullRequestFromRefRepository.md) + - [RestPullRequestFromRefRepositoryOrigin](docs/RestPullRequestFromRefRepositoryOrigin.md) + - [RestPullRequestFromRefRepositoryProject](docs/RestPullRequestFromRefRepositoryProject.md) + - [RestPullRequestMergeConfig](docs/RestPullRequestMergeConfig.md) + - [RestPullRequestMergeConfigCommitMessageTemplate](docs/RestPullRequestMergeConfigCommitMessageTemplate.md) + - [RestPullRequestMergeConfigDefaultStrategy](docs/RestPullRequestMergeConfigDefaultStrategy.md) + - [RestPullRequestMergeRequest](docs/RestPullRequestMergeRequest.md) + - [RestPullRequestMergeStrategy](docs/RestPullRequestMergeStrategy.md) + - [RestPullRequestMergeability](docs/RestPullRequestMergeability.md) + - [RestPullRequestParticipant](docs/RestPullRequestParticipant.md) + - [RestPullRequestParticipantUser](docs/RestPullRequestParticipantUser.md) + - [RestPullRequestRebaseRequest](docs/RestPullRequestRebaseRequest.md) + - [RestPullRequestRebaseResult](docs/RestPullRequestRebaseResult.md) + - [RestPullRequestRebaseResultRefChange](docs/RestPullRequestRebaseResultRefChange.md) + - [RestPullRequestRebaseResultRefChangeRef](docs/RestPullRequestRebaseResultRefChangeRef.md) + - [RestPullRequestRebaseability](docs/RestPullRequestRebaseability.md) + - [RestPullRequestRef](docs/RestPullRequestRef.md) + - [RestPullRequestReopenRequest](docs/RestPullRequestReopenRequest.md) + - [RestPullRequestSettings](docs/RestPullRequestSettings.md) + - [RestPullRequestSettingsMergeConfig](docs/RestPullRequestSettingsMergeConfig.md) + - [RestPullRequestSuggestion](docs/RestPullRequestSuggestion.md) + - [RestPushRefChange](docs/RestPushRefChange.md) + - [RestRateLimitSettings](docs/RestRateLimitSettings.md) + - [RestRawAccessToken](docs/RestRawAccessToken.md) + - [RestRefChange](docs/RestRefChange.md) + - [RestRefMatcher](docs/RestRefMatcher.md) + - [RestRefMatcherType](docs/RestRefMatcherType.md) + - [RestRefRestriction](docs/RestRefRestriction.md) + - [RestRefSyncQueue](docs/RestRefSyncQueue.md) + - [RestRefSyncRequest](docs/RestRefSyncRequest.md) + - [RestRefSyncStatus](docs/RestRefSyncStatus.md) + - [RestRefSyncStatusOrphanedRefs](docs/RestRefSyncStatusOrphanedRefs.md) + - [RestRejectedRef](docs/RestRejectedRef.md) + - [RestRepositoriesExportRequest](docs/RestRepositoriesExportRequest.md) + - [RestRepository](docs/RestRepository.md) + - [RestRepositoryHook](docs/RestRepositoryHook.md) + - [RestRepositoryHookVeto](docs/RestRepositoryHookVeto.md) + - [RestRepositoryMirrorEvent](docs/RestRepositoryMirrorEvent.md) + - [RestRepositoryPolicy](docs/RestRepositoryPolicy.md) + - [RestRepositoryPullRequestSettings](docs/RestRepositoryPullRequestSettings.md) + - [RestRepositoryPullRequestSettingsRequiredSuccessfulBuilds](docs/RestRepositoryPullRequestSettingsRequiredSuccessfulBuilds.md) + - [RestRepositoryRefChangeActivity](docs/RestRepositoryRefChangeActivity.md) + - [RestRepositoryRefChangeActivityRefChange](docs/RestRepositoryRefChangeActivityRefChange.md) + - [RestRepositorySelector](docs/RestRepositorySelector.md) + - [RestRequiredBuildCondition](docs/RestRequiredBuildCondition.md) + - [RestRequiredBuildConditionRefMatcher](docs/RestRequiredBuildConditionRefMatcher.md) + - [RestRequiredBuildConditionSetRequest](docs/RestRequiredBuildConditionSetRequest.md) + - [RestRestrictionRequest](docs/RestRestrictionRequest.md) + - [RestRestrictionRequestScope](docs/RestRestrictionRequestScope.md) + - [RestReviewerGroup](docs/RestReviewerGroup.md) + - [RestScope](docs/RestScope.md) + - [RestScopesExample](docs/RestScopesExample.md) + - [RestSecretScanningAllowlistRule](docs/RestSecretScanningAllowlistRule.md) + - [RestSecretScanningAllowlistRuleSetRequest](docs/RestSecretScanningAllowlistRuleSetRequest.md) + - [RestSecretScanningRule](docs/RestSecretScanningRule.md) + - [RestSecretScanningRuleScope](docs/RestSecretScanningRuleScope.md) + - [RestSecretScanningRuleSetRequest](docs/RestSecretScanningRuleSetRequest.md) + - [RestSetInsightReportRequest](docs/RestSetInsightReportRequest.md) + - [RestSingleAddInsightAnnotationRequest](docs/RestSingleAddInsightAnnotationRequest.md) + - [RestSshAccessKey](docs/RestSshAccessKey.md) + - [RestSshAccessKeyKey](docs/RestSshAccessKeyKey.md) + - [RestSshAccessKeyLocations](docs/RestSshAccessKeyLocations.md) + - [RestSshCredentials](docs/RestSshCredentials.md) + - [RestSshKey](docs/RestSshKey.md) + - [RestSshKeySettings](docs/RestSshKeySettings.md) + - [RestSshKeySettingsMaxExpiryDays](docs/RestSshKeySettingsMaxExpiryDays.md) + - [RestSshKeyTypeRestriction](docs/RestSshKeyTypeRestriction.md) + - [RestSshKeyTypeRestrictionMinKeyLength](docs/RestSshKeyTypeRestrictionMinKeyLength.md) + - [RestSshSettings](docs/RestSshSettings.md) + - [RestSyncProgress](docs/RestSyncProgress.md) + - [RestTag](docs/RestTag.md) + - [RestTestResults](docs/RestTestResults.md) + - [RestTokenBucketSettings](docs/RestTokenBucketSettings.md) + - [RestUpstreamServer](docs/RestUpstreamServer.md) + - [RestUpstreamSettings](docs/RestUpstreamSettings.md) + - [RestUserDirectory](docs/RestUserDirectory.md) + - [RestUserRateLimitSettings](docs/RestUserRateLimitSettings.md) + - [RestUserRateLimitSettingsUpdateRequest](docs/RestUserRateLimitSettingsUpdateRequest.md) + - [RestUserReaction](docs/RestUserReaction.md) + - [RestUserReactionComment](docs/RestUserReactionComment.md) + - [RestUserReactionCommentParent](docs/RestUserReactionCommentParent.md) + - [RestUserReactionCommentParentAnchor](docs/RestUserReactionCommentParentAnchor.md) + - [RestUserReactionCommentParentThreadResolver](docs/RestUserReactionCommentParentThreadResolver.md) + - [RestUserReactionEmoticon](docs/RestUserReactionEmoticon.md) + - [RestUsernamePasswordCredentials](docs/RestUsernamePasswordCredentials.md) + - [RestWebhook](docs/RestWebhook.md) + - [RestWebhookCredentials](docs/RestWebhookCredentials.md) + - [RestWebhookScope](docs/RestWebhookScope.md) + - [SimpleSshKeyFingerprint](docs/SimpleSshKeyFingerprint.md) + - [SshKeyIdBody](docs/SshKeyIdBody.md) + - [UserAndGroups](docs/UserAndGroups.md) + - [UserPasswordUpdate](docs/UserPasswordUpdate.md) + - [UserPickerContext](docs/UserPickerContext.md) + - [UserRename](docs/UserRename.md) + - [UserUpdate](docs/UserUpdate.md) + +## Documentation For Authorization + +## basic +- **Type**: HTTP basic authentication + +Example +```golang +auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ + UserName: "username", + Password: "password", +}) +r, err := client.Service.Operation(auth, args) +``` + +## Author + + diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_authentication.go b/vendor/github.com/gdasson/bitbucketv1go/api_authentication.go new file mode 100644 index 000000000..1d3df1f10 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_authentication.go @@ -0,0 +1,3773 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type AuthenticationApiService service +/* +AuthenticationApiService Add project SSH key +Register a new SSH key and grants access to the project identified in the URL. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *AuthenticationApiAddForProjectOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestSshAccessKey) - +@return RestSshAccessKey +*/ + +type AuthenticationApiAddForProjectOpts struct { + Body optional.Interface +} + +func (a *AuthenticationApiService) AddForProject(ctx context.Context, projectKey string, localVarOptionals *AuthenticationApiAddForProjectOpts) (RestSshAccessKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSshAccessKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/projects/{projectKey}/ssh" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestSshAccessKey + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Add repository SSH key +Register a new SSH key and grants access to the repository identified in the URL. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param repositorySlug The repository slug + * @param optional nil or *AuthenticationApiAddForRepositoryOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestSshAccessKey) - +@return RestSshAccessKey +*/ + +type AuthenticationApiAddForRepositoryOpts struct { + Body optional.Interface +} + +func (a *AuthenticationApiService) AddForRepository(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *AuthenticationApiAddForRepositoryOpts) (RestSshAccessKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSshAccessKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/projects/{projectKey}/repos/{repositorySlug}/ssh" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestSshAccessKey + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Add SSH key for user +Add a new SSH key to a supplied user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AuthenticationApiAddSshKeyOpts - Optional Parameters: + * @param "Body" (optional.Interface of LatestKeysBody) - + * @param "User" (optional.Interface of RestSshKey) - the username of the user to add the SSH key for. If no username is specified, the SSH key will be added for the current authenticated user. +@return RestSshKey +*/ + +type AuthenticationApiAddSshKeyOpts struct { + Body optional.Interface + User optional.Interface +} + +func (a *AuthenticationApiService) AddSshKey(ctx context.Context, localVarOptionals *AuthenticationApiAddSshKeyOpts) (RestSshKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSshKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ssh/latest/keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.User.IsSet() { + localVarQueryParams.Add("user", parameterToString(localVarOptionals.User.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestSshKey + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Create project HTTP token +Create an access token for the project according to the given request. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *AuthenticationApiCreateAccessToken1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestAccessTokenRequest) - The request containing the details of the access token to create. +@return RestRawAccessToken +*/ + +type AuthenticationApiCreateAccessToken1Opts struct { + Body optional.Interface +} + +func (a *AuthenticationApiService) CreateAccessToken1(ctx context.Context, projectKey string, localVarOptionals *AuthenticationApiCreateAccessToken1Opts) (RestRawAccessToken, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRawAccessToken + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/projects/{projectKey}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRawAccessToken + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Create repository HTTP token +Create an access token for the repository according to the given request. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *AuthenticationApiCreateAccessToken2Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestAccessTokenRequest) - The request containing the details of the access token to create. +@return RestRawAccessToken +*/ + +type AuthenticationApiCreateAccessToken2Opts struct { + Body optional.Interface +} + +func (a *AuthenticationApiService) CreateAccessToken2(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *AuthenticationApiCreateAccessToken2Opts) (RestRawAccessToken, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRawAccessToken + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/projects/{projectKey}/repos/{repositorySlug}" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRawAccessToken + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Create personal HTTP token +Create an access token for the user according to the given request. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userSlug The user slug. + * @param optional nil or *AuthenticationApiCreateAccessToken3Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestAccessTokenRequest) - The request containing the details of the access token to create. +@return RestRawAccessToken +*/ + +type AuthenticationApiCreateAccessToken3Opts struct { + Body optional.Interface +} + +func (a *AuthenticationApiService) CreateAccessToken3(ctx context.Context, userSlug string, localVarOptionals *AuthenticationApiCreateAccessToken3Opts) (RestRawAccessToken, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRawAccessToken + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/users/{userSlug}" + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRawAccessToken + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Delete a HTTP token +Delete the access token identified by the given ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param tokenId The token id. + +*/ +func (a *AuthenticationApiService) DeleteById(ctx context.Context, projectKey string, tokenId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/projects/{projectKey}/{tokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tokenId"+"}", fmt.Sprintf("%v", tokenId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +AuthenticationApiService Delete a HTTP token +Delete the access token identified by the given ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param tokenId The token id. + * @param repositorySlug The repository slug. + +*/ +func (a *AuthenticationApiService) DeleteById1(ctx context.Context, projectKey string, tokenId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/projects/{projectKey}/repos/{repositorySlug}/{tokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tokenId"+"}", fmt.Sprintf("%v", tokenId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +AuthenticationApiService Delete a HTTP token +Delete the access token identified by the given ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param tokenId The token id. + * @param userSlug The user slug. + +*/ +func (a *AuthenticationApiService) DeleteById2(ctx context.Context, tokenId string, userSlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/users/{userSlug}/{tokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"tokenId"+"}", fmt.Sprintf("%v", tokenId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +AuthenticationApiService Remove SSH key +Delete an SSH key. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param keyId the id of the key to delete. + +*/ +func (a *AuthenticationApiService) DeleteSshKey(ctx context.Context, keyId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ssh/latest/keys/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +AuthenticationApiService Delete all user SSH key +Delete all SSH keys for a supplied user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AuthenticationApiDeleteSshKeysOpts - Optional Parameters: + * @param "UserName" (optional.String) - the username of the user to delete the keys for. If no username is specified, the SSH keys will be deleted for the current authenticated user. + * @param "User" (optional.String) - + +*/ + +type AuthenticationApiDeleteSshKeysOpts struct { + UserName optional.String + User optional.String +} + +func (a *AuthenticationApiService) DeleteSshKeys(ctx context.Context, localVarOptionals *AuthenticationApiDeleteSshKeysOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ssh/latest/keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.UserName.IsSet() { + localVarQueryParams.Add("userName", parameterToString(localVarOptionals.UserName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.User.IsSet() { + localVarQueryParams.Add("user", parameterToString(localVarOptionals.User.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +AuthenticationApiService Get project HTTP tokens +Get all access tokens associated with the given project. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *AuthenticationApiGetAllAccessTokensOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse200 +*/ + +type AuthenticationApiGetAllAccessTokensOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *AuthenticationApiService) GetAllAccessTokens(ctx context.Context, projectKey string, localVarOptionals *AuthenticationApiGetAllAccessTokensOpts) (InlineResponse200, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse200 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/projects/{projectKey}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse200 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get repository HTTP tokens +Get all access tokens associated with the given repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *AuthenticationApiGetAllAccessTokens1Opts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse200 +*/ + +type AuthenticationApiGetAllAccessTokens1Opts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *AuthenticationApiService) GetAllAccessTokens1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *AuthenticationApiGetAllAccessTokens1Opts) (InlineResponse200, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse200 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/projects/{projectKey}/repos/{repositorySlug}" + 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 localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse200 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get personal HTTP tokens +Get all access tokens associated with the given user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userSlug The user slug. + * @param optional nil or *AuthenticationApiGetAllAccessTokens2Opts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse200 +*/ + +type AuthenticationApiGetAllAccessTokens2Opts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *AuthenticationApiService) GetAllAccessTokens2(ctx context.Context, userSlug string, localVarOptionals *AuthenticationApiGetAllAccessTokens2Opts) (InlineResponse200, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse200 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/users/{userSlug}" + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse200 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get HTTP token by ID +Get the access token identified by the given ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param tokenId The token id. +@return RestAccessToken +*/ +func (a *AuthenticationApiService) GetById(ctx context.Context, projectKey string, tokenId string) (RestAccessToken, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAccessToken + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/projects/{projectKey}/{tokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tokenId"+"}", fmt.Sprintf("%v", tokenId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAccessToken + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get HTTP token by ID +Get the access token identified by the given ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param tokenId The token id. + * @param repositorySlug The repository slug. +@return RestAccessToken +*/ +func (a *AuthenticationApiService) GetById1(ctx context.Context, projectKey string, tokenId string, repositorySlug string) (RestAccessToken, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAccessToken + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/projects/{projectKey}/repos/{repositorySlug}/{tokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tokenId"+"}", fmt.Sprintf("%v", tokenId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAccessToken + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get HTTP token by ID +Get the access token identified by the given ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param tokenId The token id. + * @param userSlug The user slug. +@return RestAccessToken +*/ +func (a *AuthenticationApiService) GetById2(ctx context.Context, tokenId string, userSlug string) (RestAccessToken, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAccessToken + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/users/{userSlug}/{tokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"tokenId"+"}", fmt.Sprintf("%v", tokenId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAccessToken + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get project SSH key +Retrieves the access key for the SSH key with id <code>keyId</code> on the project identified in the URL. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param keyId The key id +@return RestSshAccessKey +*/ +func (a *AuthenticationApiService) GetForProject(ctx context.Context, projectKey string, keyId string) (RestSshAccessKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSshAccessKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/projects/{projectKey}/ssh/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSshAccessKey + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get project SSH keys +Retrieves all project-related access keys for the SSH key with id <code>keyId</code>. If the current user is not an admin any of the projects the key provides access to, none are returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param keyId + +*/ +func (a *AuthenticationApiService) GetForProjects(ctx context.Context, keyId int32) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/ssh/{keyId}/projects" + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +AuthenticationApiService Get repository SSH key +Retrieves all repository-related access keys for the SSH key with id <code>keyId</code>. If the current user is not an admin of any of the projects the key provides access to, none are returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param keyId The key id + * @param optional nil or *AuthenticationApiGetForRepositoriesOpts - Optional Parameters: + * @param "WithRestrictions" (optional.String) - Include the readOnly field. The `readOnly` field is contextual for the user making the request. `readOnly` returns true if there is a restriction and the user does not have`PROJECT_ADMIN` access for the repository the key is associated with. + +*/ + +type AuthenticationApiGetForRepositoriesOpts struct { + WithRestrictions optional.String +} + +func (a *AuthenticationApiService) GetForRepositories(ctx context.Context, keyId string, localVarOptionals *AuthenticationApiGetForRepositoriesOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/ssh/{keyId}/repos" + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.WithRestrictions.IsSet() { + localVarQueryParams.Add("withRestrictions", parameterToString(localVarOptionals.WithRestrictions.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +AuthenticationApiService Get repository SSH keys +Retrieves the access keys for the repository identified in the URL. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *AuthenticationApiGetForRepositoryOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only SSH access keys with a label prefixed with the supplied string will be returned + * @param "Effective" (optional.String) - Controls whether SSH access keys configured at the project level should be included in the results or not. When set to <code>true</code> all keys that have <em>access</em> to the repository (including project level keys) are included in the results. When set to <code>false</code>, only access keys configured for the specified <code>repository</code> are considered. Default is <code>false</code>. + * @param "MinimumPermission" (optional.String) - If specified only SSH access keys with at least the supplied permission will be returned. Default is <code>Permission.REPO_READ</code>. + * @param "Permission" (optional.String) - + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20014 +*/ + +type AuthenticationApiGetForRepositoryOpts struct { + Filter optional.String + Effective optional.String + MinimumPermission optional.String + Permission optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *AuthenticationApiService) GetForRepository(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *AuthenticationApiGetForRepositoryOpts) (InlineResponse20014, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20014 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/projects/{projectKey}/repos/{repositorySlug}/ssh" + 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 localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Effective.IsSet() { + localVarQueryParams.Add("effective", parameterToString(localVarOptionals.Effective.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MinimumPermission.IsSet() { + localVarQueryParams.Add("minimumPermission", parameterToString(localVarOptionals.MinimumPermission.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Permission.IsSet() { + localVarQueryParams.Add("permission", parameterToString(localVarOptionals.Permission.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20014 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get repository SSH key +Retrieves the access key for the SSH key with id <code>keyId</code> on the repository identified in the URL. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param keyId The key id + * @param repositorySlug The repository slug +@return RestSshAccessKey +*/ +func (a *AuthenticationApiService) GetForRepository1(ctx context.Context, projectKey string, keyId string, repositorySlug string) (RestSshAccessKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSshAccessKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSshAccessKey + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get SSH key for user by keyId +Retrieve an SSH key by keyId + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param keyId the ID of the key to retrieve. +@return RestSshKey +*/ +func (a *AuthenticationApiService) GetSshKey(ctx context.Context, keyId string) (RestSshKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSshKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ssh/latest/keys/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSshKey + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get SSH keys for user +Retrieve a page of SSH keys. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *AuthenticationApiGetSshKeysOpts - Optional Parameters: + * @param "UserName" (optional.String) - the username of the user to retrieve the keys for. If no username is specified, the SSH keys will be retrieved for the current authenticated user. + * @param "User" (optional.String) - + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20015 +*/ + +type AuthenticationApiGetSshKeysOpts struct { + UserName optional.String + User optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *AuthenticationApiService) GetSshKeys(ctx context.Context, localVarOptionals *AuthenticationApiGetSshKeysOpts) (InlineResponse20015, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20015 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ssh/latest/keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.UserName.IsSet() { + localVarQueryParams.Add("userName", parameterToString(localVarOptionals.UserName.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.User.IsSet() { + localVarQueryParams.Add("user", parameterToString(localVarOptionals.User.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20015 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Get SSH key +Retrieves the access keys for the project identified in the URL. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *AuthenticationApiGetSshKeysForProjectOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only SSH access keys with a label prefixed with the supplied string will be returned. + * @param "Permission" (optional.String) - If specified only SSH access keys with at least the supplied permission will be returned Default is PROJECT_READ. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20014 +*/ + +type AuthenticationApiGetSshKeysForProjectOpts struct { + Filter optional.String + Permission optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *AuthenticationApiService) GetSshKeysForProject(ctx context.Context, projectKey string, localVarOptionals *AuthenticationApiGetSshKeysForProjectOpts) (InlineResponse20014, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20014 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/projects/{projectKey}/ssh" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Permission.IsSet() { + localVarQueryParams.Add("permission", parameterToString(localVarOptionals.Permission.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20014 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Revoke project SSH key +Remove an existing access key for the project identified in the URL. If the same SSH key is used as an access key for multiple projects or repositories, only the access to the project identified in the URL will be revoked. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param keyId The key id + +*/ +func (a *AuthenticationApiService) RevokeForProject(ctx context.Context, projectKey string, keyId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/projects/{projectKey}/ssh/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +AuthenticationApiService Revoke repository SSH key +Remove an existing access key for the repository identified in the URL. If the same SSH key is used as an access key for multiple projects or repositories, only the access to the repository identified in the URL will be revoked. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param keyId The key id + * @param repositorySlug The repository slug + +*/ +func (a *AuthenticationApiService) RevokeForRepository(ctx context.Context, projectKey string, keyId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +AuthenticationApiService Revoke project SSH key +Remove an existing access key for the projects and repositories in the submitted entity. If the same SSH key is used as an access key for multiple projects or repositories not supplied, only the access to the projects or repositories identified will be revoked. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param keyId The identifier of the SSH key + * @param optional nil or *AuthenticationApiRevokeManyOpts - Optional Parameters: + * @param "Body" (optional.Interface of SshKeyIdBody) - + +*/ + +type AuthenticationApiRevokeManyOpts struct { + Body optional.Interface +} + +func (a *AuthenticationApiService) RevokeMany(ctx context.Context, keyId string, localVarOptionals *AuthenticationApiRevokeManyOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/ssh/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +AuthenticationApiService Get SSH settings +Gets the SSH settings from the upstream. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestSshSettings +*/ +func (a *AuthenticationApiService) SshSettings(ctx context.Context) (RestSshSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSshSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/ssh/latest/settings" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSshSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Update HTTP token +Modify an access token according to the given request. Any fields not specified will not be altered. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param tokenId The token id. + * @param optional nil or *AuthenticationApiUpdateAccessTokenOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestAccessTokenRequest) - The request containing the details of the access token to modify +@return RestAccessToken +*/ + +type AuthenticationApiUpdateAccessTokenOpts struct { + Body optional.Interface +} + +func (a *AuthenticationApiService) UpdateAccessToken(ctx context.Context, projectKey string, tokenId string, localVarOptionals *AuthenticationApiUpdateAccessTokenOpts) (RestAccessToken, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAccessToken + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/projects/{projectKey}/{tokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tokenId"+"}", fmt.Sprintf("%v", tokenId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAccessToken + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Update HTTP token +Modify an access token according to the given request. Any fields not specified will not be altered. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param tokenId The token id. + * @param repositorySlug The repository slug. + * @param optional nil or *AuthenticationApiUpdateAccessToken1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestAccessTokenRequest) - The request containing the details of the access token to modify +@return RestAccessToken +*/ + +type AuthenticationApiUpdateAccessToken1Opts struct { + Body optional.Interface +} + +func (a *AuthenticationApiService) UpdateAccessToken1(ctx context.Context, projectKey string, tokenId string, repositorySlug string, localVarOptionals *AuthenticationApiUpdateAccessToken1Opts) (RestAccessToken, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAccessToken + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/projects/{projectKey}/repos/{repositorySlug}/{tokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tokenId"+"}", fmt.Sprintf("%v", tokenId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAccessToken + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Update HTTP token +Modify an access token according to the given request. Any fields not specified will not be altered. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param tokenId The token id. + * @param userSlug The user slug. + * @param optional nil or *AuthenticationApiUpdateAccessToken2Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestAccessTokenRequest) - The request containing the details of the access token to modify +@return RestAccessToken +*/ + +type AuthenticationApiUpdateAccessToken2Opts struct { + Body optional.Interface +} + +func (a *AuthenticationApiService) UpdateAccessToken2(ctx context.Context, tokenId string, userSlug string, localVarOptionals *AuthenticationApiUpdateAccessToken2Opts) (RestAccessToken, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAccessToken + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/access-tokens/latest/users/{userSlug}/{tokenId}" + localVarPath = strings.Replace(localVarPath, "{"+"tokenId"+"}", fmt.Sprintf("%v", tokenId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAccessToken + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Update project SSH key permission +Updates the permission granted to the specified SSH key to the project identified in the URL. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param keyId The newly created access key + * @param permission The new permission to be granted to the SSH key +@return RestSshAccessKey +*/ +func (a *AuthenticationApiService) UpdatePermission(ctx context.Context, projectKey string, keyId string, permission string) (RestSshAccessKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSshAccessKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/projects/{projectKey}/ssh/{keyId}/permission/{permission}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"permission"+"}", fmt.Sprintf("%v", permission), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSshAccessKey + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +AuthenticationApiService Update repository SSH key permission +Updates the permission granted to the specified SSH key to the repository identified in the URL. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param keyId The newly created access key + * @param permission The new permission to be granted to the SSH key + * @param repositorySlug The repository slug +@return RestSshAccessKey +*/ +func (a *AuthenticationApiService) UpdatePermission1(ctx context.Context, projectKey string, keyId string, permission string, repositorySlug string) (RestSshAccessKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSshAccessKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/keys/latest/projects/{projectKey}/repos/{repositorySlug}/ssh/{keyId}/permission/{permission}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", fmt.Sprintf("%v", keyId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"permission"+"}", fmt.Sprintf("%v", permission), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSshAccessKey + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_builds_and_deployments.go b/vendor/github.com/gdasson/bitbucketv1go/api_builds_and_deployments.go new file mode 100644 index 000000000..c43b8430a --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_builds_and_deployments.go @@ -0,0 +1,2360 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type BuildsAndDeploymentsApiService service +/* +BuildsAndDeploymentsApiService Store a build status +Store a build status. The authenticated user must have **REPO_READ** permission for the repository that this build status is for. The request can also be made with anonymous 2-legged OAuth. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit. + * @param repositorySlug The repository slug. + * @param optional nil or *BuildsAndDeploymentsApiAddOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestBuildStatusSetRequest) - The contents of the build status request are: +These fields are **required**: + + +- **key**: The string referring to this branch plan/job +- **state**: The build status state, one of: "SUCCESSFUL", "FAILED", "INPROGRESS" +- **url**: URL referring to the build result page in the CI tool. + + +These fields are optional: + + +- **buildNumber** (optional): A unique identifier for this particular run of a plan< +- **dateAdded** (optional): milliseconds since epoch. If not provided current date is used. +- **description** (optional): Describes the build result +- **duration** (optional): Duration of a completed build in milliseconds. +- **name** (optional): A short string that describes the build plan +- **parent** (optional): The identifier for the plan or job that ran the branch plan that produced this build status. +- **ref** (optional): The fully qualified git reference e.g. refs/heads/master. +- **testResults** (optional): A summary of the passed, failed and skipped tests. + + +*/ + +type BuildsAndDeploymentsApiAddOpts struct { + Body optional.Interface +} + +func (a *BuildsAndDeploymentsApiService) Add(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiAddOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Add Code Insights annotations +Add annotations to the given report. The request should be a JSON object mapping the string \"annotations\" to an array of maps containing the annotation data, as described below. See also the example request. A few things to note:- Annotations are an extension of a report, so a report must first exist in order to post annotations. Annotations are posted separately from the report, and can be posted in bulk using this endpoint. - Only the annotations that are on lines changed in the unified diff will be displayed. This means it is likely not all annotations posted will be displayed on the pull request It also means that if the user is viewing a side-by-side diff, commit diff or iterative review diff they will not be able to view the annotations. - A report cannot have more than 1000 annotations by default, however this property is congurable at an instance level. If the request would result in more than the maximum number of annotations being stored then the entire request is rejected and no new annotations are stored. - There is no de-duplication of annotations on Bitbucket so be sure that reruns of builds will first delete the report and annotations before creating them. # Annotation parameters |Parameter|Description|Required?|Restrictions|Type| |--- |--- |--- |--- |--- | |path|The path of the file on which this annotation should be placed. This is the path of the filerelative to the git repository. If no path is provided, then it will appear in the overview modalon all pull requests where the tip of the branch is the given commit, regardless of which files weremodified.|No||String| |line|The line number that the annotation should belong to. If no line number is provided, then it willdefault to 0 and in a pull request it will appear at the top of the file specified by the path field.|No|Non-negative integer|Integer| |message|The message to display to users|Yes|The maximum length accepted is 2000 characters, however the user interface may truncate this valuefor display purposes. We recommend that the message is short and succinct, with further detailsavailable to the user if needed on the page linked to by the the annotation link.|String| |severity|The severity of the annotation|Yes|One of: LOW, MEDIUM, HIGH|String| |link|An http or https URL representing the location of the annotation in the external tool|No||String| |type|The type of annotation posted|No|One of: VULNERABILITY, CODE_SMELL, BUG|String| |externalId|If the caller requires a link to get or modify this annotation, then an ID must be provided. It isnot used or required by Bitbucket, but only by the annotation creator for updating or deleting thisspecific annotation.|No|A string value shorter than 450 characters|String| + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit ID on which to record the annotation. This must be a full 40 character commit hash. + * @param repositorySlug The repository slug. + * @param key The key of the report to which this annotation belongs. + * @param optional nil or *BuildsAndDeploymentsApiAddAnnotationsOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestBulkAddInsightAnnotationRequest) - The annotations to add. + +*/ + +type BuildsAndDeploymentsApiAddAnnotationsOpts struct { + Body optional.Interface +} + +func (a *BuildsAndDeploymentsApiService) AddAnnotations(ctx context.Context, projectKey string, commitId string, repositorySlug string, key string, localVarOptionals *BuildsAndDeploymentsApiAddAnnotationsOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", fmt.Sprintf("%v", key), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Create or update a deployment +Create or update a deployment. The authenticated user must have REPO_READ permission for the repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commitId the commitId that was deployed as indicated by the path + * @param repositorySlug The repository slug + * @param optional nil or *BuildsAndDeploymentsApiCreateOrUpdateDeploymentOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestDeploymentSetRequest) - the details of the deployment to create, as detailed by the request body +@return RestDeployment +*/ + +type BuildsAndDeploymentsApiCreateOrUpdateDeploymentOpts struct { + Body optional.Interface +} + +func (a *BuildsAndDeploymentsApiService) CreateOrUpdateDeployment(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiCreateOrUpdateDeploymentOpts) (RestDeployment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestDeployment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestDeployment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Create a required builds merge check +Create a required build merge check for the given repository. The authenticated user must have **REPO_ADMIN** permission for the target repository to register a required build merge check. The contents of the required build merge check request are: These fields are **required**: - **buildParentKeys**: A non-empty list of build parent keys that require green builds for this merge check to pass - **refMatcher.id**: The value to match refs against in the target branch - **refMatcher.type.id**: The type of ref matcher, one of: \"ANY_REF\", \"BRANCH\", \"PATTERN\", \"MODEL_CATEGORY\" or \"MODEL_BRANCH\" These fields are optional: - **exemptRefMatcher.id** The value to exempt refs in the source branch from this check - **exemptRefMatcher.type.id**: The type of exempt ref matcher, one of: \"ANY_REF\", \"BRANCH\", \"PATTERN\", \"MODEL_CATEGORY\" or \"MODEL_BRANCH\" + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project that the repository belongs to + * @param repositorySlug The repository being used + * @param optional nil or *BuildsAndDeploymentsApiCreateRequiredBuildsMergeCheckOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestRequiredBuildConditionSetRequest) - The request specifying the required build parent keys, ref matcher and exemption matcher +@return RestRequiredBuildCondition +*/ + +type BuildsAndDeploymentsApiCreateRequiredBuildsMergeCheckOpts struct { + Body optional.Interface +} + +func (a *BuildsAndDeploymentsApiService) CreateRequiredBuildsMergeCheck(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiCreateRequiredBuildsMergeCheckOpts) (RestRequiredBuildCondition, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRequiredBuildCondition + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRequiredBuildCondition + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Delete a specific build status +Delete a specific build status. The authenticated user must have **REPO_ADMIN** permission for the provided repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit. + * @param repositorySlug The repository slug. + * @param optional nil or *BuildsAndDeploymentsApiDeleteOpts - Optional Parameters: + * @param "Key" (optional.String) - the key of the build status + +*/ + +type BuildsAndDeploymentsApiDeleteOpts struct { + Key optional.String +} + +func (a *BuildsAndDeploymentsApiService) Delete(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiDeleteOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Key.IsSet() { + localVarQueryParams.Add("key", parameterToString(localVarOptionals.Key.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Delete a deployment +Delete the deployment matching the specified Repository, key, environmentKey and deploymentSequenceNumber. The user must have REPO_ADMIN. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commitId the commitId that was deployed as indicated by the path + * @param repositorySlug The repository slug + * @param optional nil or *BuildsAndDeploymentsApiDelete1Opts - Optional Parameters: + * @param "DeploymentSequenceNumber" (optional.String) - the sequence number of the deployment, as detailed by the query parameter + * @param "Key" (optional.String) - the key of the deployment, as detailed by the query parameter + * @param "EnvironmentKey" (optional.String) - the key of the environment, as detailed by the query parameter + +*/ + +type BuildsAndDeploymentsApiDelete1Opts struct { + DeploymentSequenceNumber optional.String + Key optional.String + EnvironmentKey optional.String +} + +func (a *BuildsAndDeploymentsApiService) Delete1(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiDelete1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.DeploymentSequenceNumber.IsSet() { + localVarQueryParams.Add("deploymentSequenceNumber", parameterToString(localVarOptionals.DeploymentSequenceNumber.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Key.IsSet() { + localVarQueryParams.Add("key", parameterToString(localVarOptionals.Key.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnvironmentKey.IsSet() { + localVarQueryParams.Add("environmentKey", parameterToString(localVarOptionals.EnvironmentKey.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Delete a Code Insights report +Delete a report for the given commit. Also deletes any annotations associated with this report. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit ID on which to record the annotation. This must be a full 40 character commit hash. + * @param repositorySlug The repository slug. + * @param key The key of the report to which this annotation belongs. + +*/ +func (a *BuildsAndDeploymentsApiService) DeleteACodeInsightsReport(ctx context.Context, projectKey string, commitId string, repositorySlug string, key string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", fmt.Sprintf("%v", key), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Delete Code Insights annotations +Delete annotations for a given report that match the given external IDs, or all annotations if no external IDs are provided. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit ID on which to record the annotation. This must be a full 40 character commit hash. + * @param repositorySlug The repository slug. + * @param key The key of the report to which this annotation belongs. + * @param optional nil or *BuildsAndDeploymentsApiDeleteAnnotationsOpts - Optional Parameters: + * @param "ExternalId" (optional.String) - The external IDs for the annotations that are to be deleted. Can be specified more than once to delete by more than one external ID, or can be unspecified to delete all annotations. + +*/ + +type BuildsAndDeploymentsApiDeleteAnnotationsOpts struct { + ExternalId optional.String +} + +func (a *BuildsAndDeploymentsApiService) DeleteAnnotations(ctx context.Context, projectKey string, commitId string, repositorySlug string, key string, localVarOptionals *BuildsAndDeploymentsApiDeleteAnnotationsOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", fmt.Sprintf("%v", key), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ExternalId.IsSet() { + localVarQueryParams.Add("externalId", parameterToString(localVarOptionals.ExternalId.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Delete a required builds merge check +Deletes a required build existing merge check, given it's ID. The authenticated user must have **REPO_ADMIN** permission for the target repository to delete a required build merge check. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project that the repository belongs to + * @param id + * @param repositorySlug The repository being used + +*/ +func (a *BuildsAndDeploymentsApiService) DeleteRequiredBuildsMergeCheck(ctx context.Context, projectKey string, id int64, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Get a specific build status +Get a specific build status. The authenticated user must have **REPO_READ** permission for the provided repository.The request can also be made with anonymous 2-legged OAuth.<br>Since 7.14 + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit. + * @param repositorySlug The repository slug. + * @param optional nil or *BuildsAndDeploymentsApiGetOpts - Optional Parameters: + * @param "Key" (optional.String) - the key of the build status +@return RestBuildStatus +*/ + +type BuildsAndDeploymentsApiGetOpts struct { + Key optional.String +} + +func (a *BuildsAndDeploymentsApiService) Get(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiGetOpts) (RestBuildStatus, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestBuildStatus + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Key.IsSet() { + localVarQueryParams.Add("key", parameterToString(localVarOptionals.Key.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestBuildStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Get a deployment +Get the deployment matching the specified Repository, key, environmentKey and deploymentSequenceNumber. The user must have REPO_READ. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commitId the commitId that was deployed as indicated by the query parameter + * @param repositorySlug The repository slug + * @param optional nil or *BuildsAndDeploymentsApiGet1Opts - Optional Parameters: + * @param "DeploymentSequenceNumber" (optional.String) - the sequence number of the deployment, as detailed by the query param + * @param "Key" (optional.String) - the key of the deployment, as detailed by the query parameter + * @param "EnvironmentKey" (optional.String) - the key of the environment, as detailed by the query parameter +@return RestDeployment +*/ + +type BuildsAndDeploymentsApiGet1Opts struct { + DeploymentSequenceNumber optional.String + Key optional.String + EnvironmentKey optional.String +} + +func (a *BuildsAndDeploymentsApiService) Get1(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiGet1Opts) (RestDeployment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestDeployment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/deployments" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.DeploymentSequenceNumber.IsSet() { + localVarQueryParams.Add("deploymentSequenceNumber", parameterToString(localVarOptionals.DeploymentSequenceNumber.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Key.IsSet() { + localVarQueryParams.Add("key", parameterToString(localVarOptionals.Key.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.EnvironmentKey.IsSet() { + localVarQueryParams.Add("environmentKey", parameterToString(localVarOptionals.EnvironmentKey.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestDeployment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Get a Code Insights report +Retrieve the specified report. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit ID on which to record the annotation. This must be a full 40 character commit hash. + * @param repositorySlug The repository slug. + * @param key The report key. +@return RestInsightReport +*/ +func (a *BuildsAndDeploymentsApiService) GetACodeInsightsReport(ctx context.Context, projectKey string, commitId string, repositorySlug string, key string) (RestInsightReport, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestInsightReport + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", fmt.Sprintf("%v", key), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestInsightReport + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Get Code Insights annotations for a report +Retrieve the specified report's annotations. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit ID on which to record the annotation. This must be a full 40 character commit hash. + * @param repositorySlug The repository slug. + * @param key The report key. +@return RestInsightAnnotationsResponse +*/ +func (a *BuildsAndDeploymentsApiService) GetAnnotations(ctx context.Context, projectKey string, commitId string, repositorySlug string, key string) (RestInsightAnnotationsResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestInsightAnnotationsResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", fmt.Sprintf("%v", key), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestInsightAnnotationsResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Get Code Insights annotations for a commit +Get annotations for the given commit ID, filtered by any query parameters given. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit ID on which to record the annotation. This must be a full 40 character commit hash. + * @param repositorySlug The repository slug. + * @param optional nil or *BuildsAndDeploymentsApiGetAnnotations1Opts - Optional Parameters: + * @param "Severity" (optional.String) - Return only annotations that have one of the given severities. Can be specified more than once to filter by more than one severity. Valid severities are <code>LOW</code>, <code>MEDIUM</code> and <code>HIGH</code>. + * @param "Path" (optional.String) - Return only annotations that appear on one of the provided paths. Can be specified more than once to filter by more than one path. + * @param "ExternalId" (optional.String) - Return only annotations that have one of the provided external IDs. Can be specified more than once to filter by more than one external ID. + * @param "Type_" (optional.String) - Return only annotations that have one of the given types. Can be specified more than once to filter by multiple types. Valid types are <code>BUG</code>, <code>CODE_SMELL</code>, and <code>VULNERABILITY</code>. + * @param "Key" (optional.String) - Return only annotations that belong to one of the provided report keys. Can be specified more than once to filter by more than one report +@return RestInsightAnnotationsResponse +*/ + +type BuildsAndDeploymentsApiGetAnnotations1Opts struct { + Severity optional.String + Path optional.String + ExternalId optional.String + Type_ optional.String + Key optional.String +} + +func (a *BuildsAndDeploymentsApiService) GetAnnotations1(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiGetAnnotations1Opts) (RestInsightAnnotationsResponse, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestInsightAnnotationsResponse + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/annotations" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Severity.IsSet() { + localVarQueryParams.Add("severity", parameterToString(localVarOptionals.Severity.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Path.IsSet() { + localVarQueryParams.Add("path", parameterToString(localVarOptionals.Path.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ExternalId.IsSet() { + localVarQueryParams.Add("externalId", parameterToString(localVarOptionals.ExternalId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Key.IsSet() { + localVarQueryParams.Add("key", parameterToString(localVarOptionals.Key.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestInsightAnnotationsResponse + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Get build status statistics for commit +Gets statistics regarding the builds associated with a commit + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param commitId full SHA1 of the commit + * @param optional nil or *BuildsAndDeploymentsApiGetBuildStatusStatsOpts - Optional Parameters: + * @param "IncludeUnique" (optional.Bool) - include a unique build result if there is either only one failed build, only one in-progress build or only one successful build +@return RestBuildStats +*/ + +type BuildsAndDeploymentsApiGetBuildStatusStatsOpts struct { + IncludeUnique optional.Bool +} + +func (a *BuildsAndDeploymentsApiService) GetBuildStatusStats(ctx context.Context, commitId string, localVarOptionals *BuildsAndDeploymentsApiGetBuildStatusStatsOpts) (RestBuildStats, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestBuildStats + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/build-status/latest/commits/stats/{commitId}" + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.IncludeUnique.IsSet() { + localVarQueryParams.Add("includeUnique", parameterToString(localVarOptionals.IncludeUnique.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestBuildStats + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Get required builds merge checks +Returns a page of required build merge checks that have been configured for this repository. The authenticated user must have **REPO_READ** permission for the target repository to request a page of required build merge checks. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project that the repository belongs to + * @param repositorySlug The repository being used + * @param optional nil or *BuildsAndDeploymentsApiGetPageOfRequiredBuildsMergeChecksOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2002 +*/ + +type BuildsAndDeploymentsApiGetPageOfRequiredBuildsMergeChecksOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *BuildsAndDeploymentsApiService) GetPageOfRequiredBuildsMergeChecks(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiGetPageOfRequiredBuildsMergeChecksOpts) (InlineResponse2002, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2002 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/conditions" + 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 localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2002 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Get all Code Insights reports for a commit +Retrieve all reports for the given commit. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit ID on which to record the annotation. This must be a full 40 character commit hash. + * @param repositorySlug The repository slug. + * @param optional nil or *BuildsAndDeploymentsApiGetReportsOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2004 +*/ + +type BuildsAndDeploymentsApiGetReportsOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *BuildsAndDeploymentsApiService) GetReports(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiGetReportsOpts) (InlineResponse2004, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2004 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2004 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Create a Code Insights report +Create a new insight report, or replace the existing one if a report already exists for the given repository, commit, and report key. A request to replace an existing report will be rejected if the authenticated user was not the creator of the specified report. The report key should be a unique string chosen by the reporter and should be unique enough not to potentially clash with report keys from other reporters. We recommend using reverse DNS namespacing or a similar standard to ensure that collision is avoided.<h1>Report parameters</h1><table summary=\"Report parameters\"> <tr> <th>Parameter</th> <th>Description</th> <th>Required?</th> <th>Restrictions</th> <th>Type</th> </tr> <tr> <td>title</td> <td>A short string representing the name of the report</td> <td>Yes</td> <td>Max length: 450 characters (but we recommend that it is shorter so that the display is nicer)</td> <td>String</td> </tr> <tr> <td>details</td> <td> A string to describe the purpose of the report. This string may contain escaped newlines and if it does it will display the content accordingly. </td> <td>No</td> <td>Max length: 2000 characters</td> <td>String</td> </tr> <tr> <td>result</td> <td>Indicates whether the report is in a passed or failed state</td> <td>No</td> <td>One of: PASS, FAIL</td> <td>String</td> </tr> <tr> <td>data</td> <td>An array of data fields (described below) to display information on the report</td> <td>No</td> <td>Maximum 6 data fields</td> <td>Array</td> </tr> <tr> <td>reporter</td> <td>A string to describe the tool or company who created the report</td> <td>No</td> <td>Max length: 450 characters</td> <td>String</td> </tr> <tr> <td>link</td> <td>A URL linking to the results of the report in an external tool.</td> <td>No</td> <td>Must be a valid http or https URL</td> <td>String</td> </tr> <tr> <td>logoUrl</td> <td>A URL to the report logo. If none is provided, the default insights logo will be used.</td> <td>No</td> <td>Must be a valid http or https URL</td> <td>String</td> </tr></table><h1>Data parameters</h1>The data field on the report is an array with at most 6 data fields (JSON maps) containing information that is to be displayed on the report (see the request example).<table summary=\"Data parameters\"> <tr> <th>Parameter</th> <th>Description</th> <th>Type</th> </tr> <tr> <td>title</td> <td>A string describing what this data field represents</td> <td>String</td> </tr> <tr> <td>type</td> <td> The type of data contained in the value field. If not provided, then the value will be detected as a boolean, number or string. One of: BOOLEAN, DATE, DURATION, LINK, NUMBER, PERCENTAGE, TEXT </td> <td>String</td> </tr> <tr> <td>value</td> <td> A value based on the type provided. Either a raw value (string, number or boolean) or a map. See below. </td> </tr></table><table summary=\"Types\"> <tr> <th>Type Field</th> <th>Value Field Type</th> <th>Value Field Display</th> </tr> <tr> <td>None/Omitted</td> <td>Number, String or Boolean (not an array or object)</td> <td>Plain text</td> </tr> <tr> <td>BOOLEAN</td> <td>Boolean</td> <td>The value will be read as a JSON boolean and displayed as 'Yes' or 'No'.</td> </tr> <tr> <td>DATE</td> <td>Number</td> <td> The value will be read as a JSON number in the form of a Unix timestamp (milliseconds) and will be displayed as a relative date if the date is less than one week ago, otherwise it will be displayed as an absolute date. </td> </tr> <tr> <td>DURATION</td> <td>Number</td> <td> The value will be read as a JSON number in milliseconds and will be displayed in a human readable duration format. </td> </tr> <tr> <td>LINK</td> <td>Object: {\"linktext\": \"Link text here\", \"href\": \"https://link.to.annotation/in/external/tool\"}</td> <td> The value will be read as a JSON object containing the fields \"linktext\" and \"href\" and will be displayed as a clickable link on the report. </td> </tr> <tr> <td>NUMBER</td> <td>Number</td> <td> The value will be read as a JSON number and large numbers will be displayed in a human readable format (e.g. 14.3k). </td> </tr> <tr> <td>PERCENTAGE</td> <td>Number (between 0 and 100)</td> <td> The value will be read as a JSON number between 0 and 100 and will be displayed with a percentage sign. </td> </tr> <tr> <td>TEXT</td> <td>String</td> <td>The value will be read as a JSON string and will be displayed as-is</td> </tr></table> + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId The commit ID on which to record the annotation. This must be a full 40 character commit hash. + * @param repositorySlug The repository slug. + * @param key A unique string representing the report as chosen by the reporter. This should be unique enough to not clash with other report's keys. To do this, we recommend namespacing the key using reverse DNS + * @param optional nil or *BuildsAndDeploymentsApiSetACodeInsightsReportOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestSetInsightReportRequest) - The request object containing the details of the report to create (see example). +@return RestInsightReport +*/ + +type BuildsAndDeploymentsApiSetACodeInsightsReportOpts struct { + Body optional.Interface +} + +func (a *BuildsAndDeploymentsApiService) SetACodeInsightsReport(ctx context.Context, projectKey string, commitId string, repositorySlug string, key string, localVarOptionals *BuildsAndDeploymentsApiSetACodeInsightsReportOpts) (RestInsightReport, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestInsightReport + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", fmt.Sprintf("%v", key), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestInsightReport + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Create or replace a Code Insights annotation +Create an annotation with the given external ID, or replace it if it already exists. A request to replace an existing annotation will be rejected if the authenticated user was not the creator of the specified report. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param externalId The external ID of the annotation that is to be updated or created + * @param commitId The commit ID on which to record the annotation. This must be a full 40 character commit hash. + * @param repositorySlug The repository slug. + * @param key The key of the report to which this annotation belongs + * @param optional nil or *BuildsAndDeploymentsApiSetAnnotationOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestSingleAddInsightAnnotationRequest) - The new annotation that is to replace the existing one. + +*/ + +type BuildsAndDeploymentsApiSetAnnotationOpts struct { + Body optional.Interface +} + +func (a *BuildsAndDeploymentsApiService) SetAnnotation(ctx context.Context, projectKey string, externalId string, commitId string, repositorySlug string, key string, localVarOptionals *BuildsAndDeploymentsApiSetAnnotationOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/insights/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/reports/{key}/annotations/{externalId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"externalId"+"}", fmt.Sprintf("%v", externalId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", fmt.Sprintf("%v", key), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +BuildsAndDeploymentsApiService Update a required builds merge check +Update the required builds merge check for the given ID. The authenticated user must have **REPO_ADMIN** permission for the target repository to update a required build merge check. The contents of the required build merge check request are: These fields are **required**: - **buildParentKeys**: A non-empty list of build parent keys that require green builds for this merge check to pass - **refMatcher.id**: The value to match refs against in the target branch - **refMatcher.type.id**: The type of ref matcher, one of: \"ANY_REF\", \"BRANCH\", \"PATTERN\", \"MODEL_CATEGORY\" or \"MODEL_BRANCH\" These fields are optional: - **exemptRefMatcher.id** The value to exempt refs in the source branch from this check - **exemptRefMatcher.type.id**: The type of exempt ref matcher, one of: \"ANY_REF\", \"BRANCH\", \"PATTERN\", \"MODEL_CATEGORY\" or \"MODEL_BRANCH\" + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project that the repository belongs to + * @param id + * @param repositorySlug The repository being used + * @param optional nil or *BuildsAndDeploymentsApiUpdateRequiredBuildsMergeCheckOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestRequiredBuildConditionSetRequest) - The request specifying the required build parent keys, ref matcher and exemption matcher +@return RestRequiredBuildCondition +*/ + +type BuildsAndDeploymentsApiUpdateRequiredBuildsMergeCheckOpts struct { + Body optional.Interface +} + +func (a *BuildsAndDeploymentsApiService) UpdateRequiredBuildsMergeCheck(ctx context.Context, projectKey string, id int64, repositorySlug string, localVarOptionals *BuildsAndDeploymentsApiUpdateRequiredBuildsMergeCheckOpts) (RestRequiredBuildCondition, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRequiredBuildCondition + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/required-builds/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRequiredBuildCondition + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_capabilities.go b/vendor/github.com/gdasson/bitbucketv1go/api_capabilities.go new file mode 100644 index 000000000..b27fe76c8 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_capabilities.go @@ -0,0 +1,184 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// Linger please +var ( + _ context.Context +) + +type CapabilitiesApiService service +/* +CapabilitiesApiService Get build capabilities +Returns the build capabilities of this instance + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestBuildCapabilities +*/ +func (a *CapabilitiesApiService) GetCapabilities(ctx context.Context) (RestBuildCapabilities, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestBuildCapabilities + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/build/capabilities" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestBuildCapabilities + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +CapabilitiesApiService Get deployment capabilities +Returns the Deployment capabilities of this instance + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *CapabilitiesApiService) GetCapabilities1(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/deployment/capabilities" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_dashboard.go b/vendor/github.com/gdasson/bitbucketv1go/api_dashboard.go new file mode 100644 index 000000000..601fa8c0a --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_dashboard.go @@ -0,0 +1,292 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type DashboardApiService service +/* +DashboardApiService Get pull request suggestions +Retrieves a page of suggestions for pull requests that the currently authenticated user may wish to raise. Such suggestions are based on ref changes occurring and so contain the ref change that prompted the suggestion plus the time the change event occurred. Changes will be returned in descending order based on the time the change that prompted the suggestion occurred. Note that although the response is a page object, the interface does not support paging, however a limit can be applied to the size of the returned page. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DashboardApiGetPullRequestSuggestionsOpts - Optional Parameters: + * @param "ChangesSince" (optional.String) - restrict pull request suggestions to be based on events that occurred since some timein the past. This is expressed in seconds since \"now\". So to return suggestionsbased only on activity within the past 48 hours, pass a value of 172800. + * @param "Limit" (optional.String) - restricts the result set to return at most this many suggestions. +@return InlineResponse20021 +*/ + +type DashboardApiGetPullRequestSuggestionsOpts struct { + ChangesSince optional.String + Limit optional.String +} + +func (a *DashboardApiService) GetPullRequestSuggestions(ctx context.Context, localVarOptionals *DashboardApiGetPullRequestSuggestionsOpts) (InlineResponse20021, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20021 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/dashboard/pull-request-suggestions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ChangesSince.IsSet() { + localVarQueryParams.Add("changesSince", parameterToString(localVarOptionals.ChangesSince.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20021 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +DashboardApiService Get pull requests for a user +Retrieve a page of pull requests where a user is involved as either a reviewer, author or a participant. The request may be filtered by pull request state, role or participant status. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DashboardApiGetPullRequests1Opts - Optional Parameters: + * @param "ClosedSince" (optional.String) - (optional, defaults to returning pull requests regardless of closed since date). Permits returning only pull requests with a closed timestamp set more recently that (now - closedSince). Units are in seconds. So for example if closed since 86400 is set only pull requests closed in the previous 24 hours will be returned. + * @param "Role" (optional.String) - (optional, defaults to returning pull requests for any role). If a role is supplied only pull requests where the authenticated user is a participant in the given role will be returned. Either <strong>REVIEWER</strong>, <strong>AUTHOR</strong> or <strong>PARTICIPANT</strong>. + * @param "ParticipantStatus" (optional.String) - (optional, defaults to returning pull requests with any participant status). A comma separated list of participant status. That is, one or more of <strong>UNAPPROVED</strong>, <strong>NEEDS_WORK</strong>, or <strong>APPROVED</strong>. + * @param "State" (optional.String) - (optional, defaults to returning pull requests in any state). If a state is supplied only pull requests in the specified state will be returned. Either <strong>OPEN</strong>, <strong>DECLINED</strong> or <strong>MERGED</strong>. Omit this parameter to return pull request in any state. + * @param "User" (optional.String) - The name of the involved user, defaults to the current user. + * @param "Order" (optional.String) - (optional, defaults to <strong>NEWEST</strong>) the order to return pull requests in, either <strong>OLDEST</strong> (as in: \"oldest first\"), <strong>NEWEST</strong>, <strong>PARTICIPANT_STATUS</strong>, or <strong>CLOSED_DATE</strong>. Where <strong>CLOSED_DATE</strong> is specified and the result set includes pull requests that are not in the closed state, these pull requests will appear first in the result set, followed by most recently closed pull requests. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20022 +*/ + +type DashboardApiGetPullRequests1Opts struct { + ClosedSince optional.String + Role optional.String + ParticipantStatus optional.String + State optional.String + User optional.String + Order optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *DashboardApiService) GetPullRequests1(ctx context.Context, localVarOptionals *DashboardApiGetPullRequests1Opts) (InlineResponse20022, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20022 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/dashboard/pull-requests" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ClosedSince.IsSet() { + localVarQueryParams.Add("closedSince", parameterToString(localVarOptionals.ClosedSince.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Role.IsSet() { + localVarQueryParams.Add("role", parameterToString(localVarOptionals.Role.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ParticipantStatus.IsSet() { + localVarQueryParams.Add("participantStatus", parameterToString(localVarOptionals.ParticipantStatus.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.State.IsSet() { + localVarQueryParams.Add("state", parameterToString(localVarOptionals.State.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.User.IsSet() { + localVarQueryParams.Add("user", parameterToString(localVarOptionals.User.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20022 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_default.go b/vendor/github.com/gdasson/bitbucketv1go/api_default.go new file mode 100644 index 000000000..6f6d2fd3e --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_default.go @@ -0,0 +1,178 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type DefaultApiService service +/* +DefaultApiService Get total number of pull requests in inbox +Returns the total number of pull requests in the user's inbox + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *DefaultApiService) GetPullRequestCount(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/inbox/pull-requests/count" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DefaultApiService Get pull requests in inbox +Returns a page of pull requests in the user's inbox. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DefaultApiGetPullRequests2Opts - Optional Parameters: + * @param "Role" (optional.String) - + * @param "Limit" (optional.Int32) - + * @param "Start" (optional.Int32) - + +*/ + +type DefaultApiGetPullRequests2Opts struct { + Role optional.String + Limit optional.Int32 + Start optional.Int32 +} + +func (a *DefaultApiService) GetPullRequests2(ctx context.Context, localVarOptionals *DefaultApiGetPullRequests2Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/inbox/pull-requests" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Role.IsSet() { + localVarQueryParams.Add("role", parameterToString(localVarOptionals.Role.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_deprecated.go b/vendor/github.com/gdasson/bitbucketv1go/api_deprecated.go new file mode 100644 index 000000000..516998c70 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_deprecated.go @@ -0,0 +1,2661 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type DeprecatedApiService service +/* +DeprecatedApiService Create build status for commit +Associates a build status with a commit.The <code>state</code>, the <code>key</code> and the <code>url</code> fields are mandatory. The <code>name</code> and<code>description</code> fields are optional.All fields (mandatory or optional) are limited to 255 characters, except for the <code>url</code>,which is limited to 450 characters.Supported values for the <code>state</code> are <code>SUCCESSFUL</code>, <code>FAILED</code>and <code>INPROGRESS</code>.The authenticated user must have <strong>LICENSED</strong> permission or higher to call this resource. <strong>Deprecated in 7.14, please use the repository based builds resource instead.</strong> + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param commitId full SHA1 of the commit + * @param optional nil or *DeprecatedApiAddBuildStatusOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestBuildStatus) - build status to associate with the commit + +*/ + +type DeprecatedApiAddBuildStatusOpts struct { + Body optional.Interface +} + +func (a *DeprecatedApiService) AddBuildStatus(ctx context.Context, commitId string, localVarOptionals *DeprecatedApiAddBuildStatusOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/build-status/latest/commits/{commitId}" + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Add user to group +<strong>Deprecated since 2.10</strong>. Use /rest/users/add-groups instead. Add a user to a group. This is very similar to <code>groups/add-user</code>, but with the <em>context</em> and <em>itemName</em> attributes of the supplied request entity reversed. On the face of it this may appear redundant, but it facilitates a specific UI component in the application. In the request entity, the <em>context</em> attribute is the user and the <em>itemName</em> is the group. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DeprecatedApiAddGroupToUserOpts - Optional Parameters: + * @param "Body" (optional.Interface of GroupPickerContext) - + +*/ + +type DeprecatedApiAddGroupToUserOpts struct { + Body optional.Interface +} + +func (a *DeprecatedApiService) AddGroupToUser(ctx context.Context, localVarOptionals *DeprecatedApiAddGroupToUserOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/add-group" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Add user to group +<strong>Deprecated since 2.10</strong>. Use /rest/users/add-groups instead. Add a user to a group. In the request entity, the <em>context</em> attribute is the group and the <em>itemName</em> is the user. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DeprecatedApiAddUserToGroupOpts - Optional Parameters: + * @param "Body" (optional.Interface of UserPickerContext) - + +*/ + +type DeprecatedApiAddUserToGroupOpts struct { + Body optional.Interface +} + +func (a *DeprecatedApiService) AddUserToGroup(ctx context.Context, localVarOptionals *DeprecatedApiAddUserToGroupOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/groups/add-user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Approve pull request +Approve a pull request as the current user. Implicitly adds the user as a participant if they are not already. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. <strong>Deprecated since 4.2</strong>. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} instead + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. +@return RestPullRequestParticipant +*/ +func (a *DeprecatedApiService) Approve(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (RestPullRequestParticipant, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestParticipant + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestParticipant + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +DeprecatedApiService Get pull request task count +Retrieve the total number of OPEN and RESOLVED tasks associated with a pull request. <strong>Deprecated since 7.2</strong>. Tasks are now managed using Comments with BLOCKER severity. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments?count=true instead. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + +*/ +func (a *DeprecatedApiService) CountPullRequestTasks(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/tasks/count" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Create task +Create a new task. <strong>Removed in 8.0</strong>. Tasks are now managed using Comments with severity BLOCKER. Call <code>POST /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments</code> instead,passing the attribute 'severity' set to 'BLOCKER'. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *DeprecatedApiService) CreateTask(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/tasks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Delete task +Delete a task. <strong>Removed in 8.0</strong>. Tasks are now managed using Comments with BLOCKER severity. Call <code>DELETE /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}</code>instead. @deprecated since 7.2, changed to 404 in 8.0, remove in 9.0. Call DELETE /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} instead. Note that only the task's creator, the context's author or an admin of the context's repository can delete a task. (For a pull request task, those are the task's creator, the pull request's author or an admin on the repository containing the pull request). Additionally a task cannot be deleted if it has already been resolved. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param taskId the id identifying the task to delete + +*/ +func (a *DeprecatedApiService) DeleteTask(ctx context.Context, taskId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/tasks/{taskId}" + localVarPath = strings.Replace(localVarPath, "{"+"taskId"+"}", fmt.Sprintf("%v", taskId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Get build statuses for commit +Gets build statuses associated with a commit. <strong>Deprecated in 7.14, please use the repository based builds resource instead.</strong> + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param commitId Full SHA1 of the commit (ex: <code>e00cf62997a027bbf785614a93e2e55bb331d268</code>) + * @param optional nil or *DeprecatedApiGetBuildStatusOpts - Optional Parameters: + * @param "OrderBy" (optional.String) - How the results should be ordered. Options are NEWEST, OLDEST, STATUS + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2001 +*/ + +type DeprecatedApiGetBuildStatusOpts struct { + OrderBy optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *DeprecatedApiService) GetBuildStatus(ctx context.Context, commitId string, localVarOptionals *DeprecatedApiGetBuildStatusOpts) (InlineResponse2001, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2001 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/build-status/latest/commits/{commitId}" + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.OrderBy.IsSet() { + localVarQueryParams.Add("orderBy", parameterToString(localVarOptionals.OrderBy.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2001 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +DeprecatedApiService Get build status statistics for commit +Gets statistics regarding the builds associated with a commit + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param commitId full SHA1 of the commit + * @param optional nil or *DeprecatedApiGetBuildStatusStatsOpts - Optional Parameters: + * @param "IncludeUnique" (optional.Bool) - include a unique build result if there is either only one failed build, only one in-progress build or only one successful build +@return RestBuildStats +*/ + +type DeprecatedApiGetBuildStatusStatsOpts struct { + IncludeUnique optional.Bool +} + +func (a *DeprecatedApiService) GetBuildStatusStats(ctx context.Context, commitId string, localVarOptionals *DeprecatedApiGetBuildStatusStatsOpts) (RestBuildStats, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestBuildStats + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/build-status/latest/commits/stats/{commitId}" + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.IncludeUnique.IsSet() { + localVarQueryParams.Add("includeUnique", parameterToString(localVarOptionals.IncludeUnique.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestBuildStats + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +DeprecatedApiService Get default branch +Retrieves the repository's default branch, if it has been created. If the repository is empty, 204 No Content will be returned. For non-empty repositories, if the configured default branch has not yet been created a 404 Not Found will be returned. This URL is deprecated. Callers should use <code>GET /projects/{key}/repos/{slug}/default-branch</code> instead, which allows retrieving the <i>configured</i> default branch even if the ref has not been created yet. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return RestBranch +*/ +func (a *DeprecatedApiService) GetDefaultBranch1(ctx context.Context, projectKey string, repositorySlug string) (RestBranch, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestBranch + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches/default" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestBranch + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +DeprecatedApiService Get comment likes +Get a page of users who liked a commit comment in the specified repository, identified by <code>commitId</code> and <code>commentId</code>. The authenticated user must have the **REPO_READ** (or higher) permission for the specified repository to access this resource. <strong>Deprecated in 8.0 to be removed in 9.0.</strong> + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId + * @param commitId The commit id. + * @param repositorySlug The repository slug. + * @param optional nil or *DeprecatedApiGetLikersOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2005 +*/ + +type DeprecatedApiGetLikersOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *DeprecatedApiService) GetLikers(ctx context.Context, projectKey string, commentId int64, commitId string, repositorySlug string, localVarOptionals *DeprecatedApiGetLikersOpts) (InlineResponse2005, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2005 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/likes" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2005 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +DeprecatedApiService Get pull request comment likes +Get a page of users who liked a pull request comment in the specified repository, identified by <code>pullRequestId</code> and <code>commentId</code>. The authenticated user must have the <strong>REPO_READ</strong> (or higher) permission for the specified repository to access this resource. **Deprecated in 8.0 to be removed in 9.0.** + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The comment id. + * @param pullRequestId The pull request id. + * @param repositorySlug The repository slug. + * @param optional nil or *DeprecatedApiGetLikers1Opts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2005 +*/ + +type DeprecatedApiGetLikers1Opts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *DeprecatedApiService) GetLikers1(ctx context.Context, projectKey string, commentId string, pullRequestId string, repositorySlug string, localVarOptionals *DeprecatedApiGetLikers1Opts) (InlineResponse2005, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2005 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/likes" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2005 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +DeprecatedApiService Get pull request tasks +Retrieve the tasks associated with a pull request. **Removed in 8.0**. Tasks are now managed using Comments with BLOCKER severity. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments instead **Deprecated since 7.2, changed to 404 in 8.0, remove in 9.0.** Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments instead + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + +*/ +func (a *DeprecatedApiService) GetPullRequestTasks(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/tasks" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Get task +Retrieve an existing task. <strong>Removed in 8.0</strong>. Tasks are now managed using Comments with BLOCKER severity. Call <code>GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} </code>instead. @deprecated since 7.2, changed to 404 in 8.0, remove in 9.0. Call GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} instead. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param taskId the id identifying the task + +*/ +func (a *DeprecatedApiService) GetTask(ctx context.Context, taskId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/tasks/{taskId}" + localVarPath = strings.Replace(localVarPath, "{"+"taskId"+"}", fmt.Sprintf("%v", taskId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Like a commit comment +Like a commit comment in the specified repository, identified by <code>commitId</code> and <code>commentId</code>. The authenticated user must have the <strong>REPO_READ</strong> (or higher) permission for the specified repository to access this resource. <strong>Deprecated in 8.0 to be removed in 9.0.</strong> Likes have been replaced with reactions. For backwards compatibility, the <pre>thumbsup</pre> reaction is treated as a like. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId + * @param commitId The commit id. + * @param repositorySlug The repository slug. + +*/ +func (a *DeprecatedApiService) Like(ctx context.Context, projectKey string, commentId int64, commitId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/likes" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Like a pull request comment +Like a pull request comment in the specified repository, identified by <code>pullRequestId</code> and <code>commentId</code>. The like will be recorded against the requesting user. The authenticated user must have the <strong>REPO_READ</strong> (or higher) permission for the specified repository to access this resource. **Deprecated in 8.0 to be removed in 9.0.** Likes have been replaced with reactions. For backwards compatibility, the <pre>thumbsup</pre> reaction is treated as a like. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The comment id. + * @param pullRequestId The pull request id. + * @param repositorySlug The repository slug. + +*/ +func (a *DeprecatedApiService) Like1(ctx context.Context, projectKey string, commentId string, pullRequestId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/likes" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService On disable of mirror addon +This REST endpoint is retained for backwards compatibility only. It is a no-op. Starting from 4.6.0, mirrors no longer specify a disabled lifecycle callback in their addon descriptor. Prior to 4.6.0, this was the callback method that was called when the mirroring atlassian-connect add-on has been disabled in the upstream server identified by <code> upstreamId</code>. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId the upstream server ID to retrieve settings for + +*/ +func (a *DeprecatedApiService) OnAddonDisabled(ctx context.Context, upstreamId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/addon/disabled" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService On enabled of mirror addon +This REST endpoint is retained for backwards compatibility only. It is a no-op. Starting from 4.6.0, mirrors no longer specify an enabled lifecycle callback in their addon descriptor. Prior to 4.6.0, this was the callback method that was called when the mirroring atlassian-connect add-on has been enabled in the upstream server identified by <code>upstreamId</code>. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId the upstream server ID to retrieve settings for + +*/ +func (a *DeprecatedApiService) OnAddonEnabled(ctx context.Context, upstreamId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/addon/enabled" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Remove user from group +<strong>Deprecated since 2.10</strong>. Use /rest/users/remove-groups instead. Remove a user from a group. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. In the request entity, the <em>context</em> attribute is the group and the <em>itemName</em> is the user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *DeprecatedApiRemoveUserFromGroupOpts - Optional Parameters: + * @param "Body" (optional.Interface of UserPickerContext) - + +*/ + +type DeprecatedApiRemoveUserFromGroupOpts struct { + Body optional.Interface +} + +func (a *DeprecatedApiService) RemoveUserFromGroup(ctx context.Context, localVarOptionals *DeprecatedApiRemoveUserFromGroupOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/groups/remove-user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Update default branch +Update the default branch of a repository. This URL is deprecated. Callers should use <code>PUT /projects/{key}/repos/{slug}/default-branch</code> instead. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *DeprecatedApiSetDefaultBranch1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestBranch) - The branch to set as default + +*/ + +type DeprecatedApiSetDefaultBranch1Opts struct { + Body optional.Interface +} + +func (a *DeprecatedApiService) SetDefaultBranch1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *DeprecatedApiSetDefaultBranch1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches/default" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Get upstream settings +This method is no longer supported + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamRepoId + * @param upstreamId the upstream server ID to retrieve settings for + * @param optional nil or *DeprecatedApiSynchronizeRepositoryWithUpstreamOpts - Optional Parameters: + * @param "Level" (optional.String) - the level of synchronization to perform + +*/ + +type DeprecatedApiSynchronizeRepositoryWithUpstreamOpts struct { + Level optional.String +} + +func (a *DeprecatedApiService) SynchronizeRepositoryWithUpstream(ctx context.Context, upstreamRepoId string, upstreamId string, localVarOptionals *DeprecatedApiSynchronizeRepositoryWithUpstreamOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/repos/{upstreamRepoId}/synchronization" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamRepoId"+"}", fmt.Sprintf("%v", upstreamRepoId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Level.IsSet() { + localVarQueryParams.Add("level", parameterToString(localVarOptionals.Level.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Change upstream settings +This method is no longer supported + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId the upstream server ID to retrieve settings for + * @param optional nil or *DeprecatedApiSynchronizeWithUpstreamOpts - Optional Parameters: + * @param "Level" (optional.String) - + +*/ + +type DeprecatedApiSynchronizeWithUpstreamOpts struct { + Level optional.String +} + +func (a *DeprecatedApiService) SynchronizeWithUpstream(ctx context.Context, upstreamId string, localVarOptionals *DeprecatedApiSynchronizeWithUpstreamOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/synchronization" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Level.IsSet() { + localVarQueryParams.Add("level", parameterToString(localVarOptionals.Level.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Unassign pull request participant +Unassigns a participant from the REVIEWER role they may have been given in a pull request. If the participant has no explicit role this method has no effect. Afterwards, the user will still remain a participant in the pull request but their role will be reduced to PARTICIPANT. This is because once made a participant of a pull request, a user will forever remain a participant. Only their role may be altered. The authenticated user must have <strong>REPO_WRITE</strong> permission for the repository that this pull request targets to call this resource. <strong>Deprecated since 4.2</strong>. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} instead. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + * @param optional nil or *DeprecatedApiUnassignParticipantRole1Opts - Optional Parameters: + * @param "Username" (optional.String) - + +*/ + +type DeprecatedApiUnassignParticipantRole1Opts struct { + Username optional.String +} + +func (a *DeprecatedApiService) UnassignParticipantRole1(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *DeprecatedApiUnassignParticipantRole1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Username.IsSet() { + localVarQueryParams.Add("username", parameterToString(localVarOptionals.Username.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Unlike a commit comment +Unlike a commit comment in the specified repository, identified by <code>commitId</code> and <code>commentId</code>. The authenticated user must have the <strong>REPO_READ</strong> (or higher) permission for the specified repository to access this resource. <strong>Deprecated in 8.0 to be removed in 9.0.</strong> Likes have been replaced with reactions. For backwards compatibility, the <pre>thumbsup</pre> reaction is treated as a like. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId + * @param commitId The commit id. + * @param repositorySlug The repository slug. + +*/ +func (a *DeprecatedApiService) Unlike(ctx context.Context, projectKey string, commentId int64, commitId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/likes" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Unlike a pull request comment +Unlike a pull request comment in the specified repository, identified by <code>pullRequestId</code> and <code>commentId</code>. The authenticated user must have the <strong>REPO_READ</strong> (or higher) permission for the specified repository to access this resource. **Deprecated in 8.0 to be removed in 9.0.** Likes have been replaced with reactions. For backwards compatibility, the <pre>thumbsup</pre> reaction is treated as a like. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The comment id. + * @param pullRequestId The pull request id. + * @param repositorySlug The repository slug. + +*/ +func (a *DeprecatedApiService) Unlike1(ctx context.Context, projectKey string, commentId string, pullRequestId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/likes" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Update task +Update an existing task. <strong>Removed in 8.0</strong>. Tasks are now managed using Comments with BLOCKER severity. Call <code>PUT /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} </code> instead. To resolve a task, pass the attribute 'state' set to 'RESOLVED'. @deprecated since 7.2, changed to 404 in 8.0, remove in 9.0. Call <code>PUT /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} </code> instead. As of Stash 3.3, only the state and text of a task can be updated. Updating the state of a task is allowed for any user having <em>READ</em> access to the repository. However only the task's creator, the context's author or an admin of the context's repository can update the task's text. (For a pull request task, those are the task's creator, the pull request's author or an admin on the repository containing the pull request). Additionally the task's text cannot be updated if it has been resolved. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param taskId the id identifying the task to update + +*/ +func (a *DeprecatedApiService) UpdateTask(ctx context.Context, taskId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/tasks/{taskId}" + localVarPath = strings.Replace(localVarPath, "{"+"taskId"+"}", fmt.Sprintf("%v", taskId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +DeprecatedApiService Unapprove pull request +Remove approval from a pull request as the current user. This does not remove the user as a participant. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. <strong>Deprecated since 4.2</strong>. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} instead + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. +@return RestPullRequestParticipant +*/ +func (a *DeprecatedApiService) WithdrawApproval(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (RestPullRequestParticipant, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestParticipant + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestParticipant + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_jira_integration.go b/vendor/github.com/gdasson/bitbucketv1go/api_jira_integration.go new file mode 100644 index 000000000..c75004a93 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_jira_integration.go @@ -0,0 +1,429 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type JiraIntegrationApiService service +/* +JiraIntegrationApiService Create Jira Issue +Create a Jira issue and associate it with a comment on a pull request. This resource can only be used with comments on a pull request. Attempting to call this resource with a different type of comment (for example, a comment on a commit) will result in an error. The authenticated user must have <strong>REPO_READ</strong> permission for the repository containing the comment to call this resource. The JSON structure for the create issue format is specified by Jira's REST v2 API. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param commentId the comment to associate the created Jira issue to + * @param optional nil or *JiraIntegrationApiCreateIssueOpts - Optional Parameters: + * @param "Body" (optional.Interface of string) - A String representation of the JSON format Jira create issue request see: <a href="https://docs.atlassian.com/jira/REST/server/#api/2/issue-createIssue">Jira REST API</a> + * @param "ApplicationId" (optional.String) - id of the Jira server +@return RestCommentJiraIssue +*/ + +type JiraIntegrationApiCreateIssueOpts struct { + Body optional.Interface + ApplicationId optional.String +} + +func (a *JiraIntegrationApiService) CreateIssue(ctx context.Context, commentId string, localVarOptionals *JiraIntegrationApiCreateIssueOpts) (RestCommentJiraIssue, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestCommentJiraIssue + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/jira/latest/comments/{commentId}/issues" + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ApplicationId.IsSet() { + localVarQueryParams.Add("applicationId", parameterToString(localVarOptionals.ApplicationId.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestCommentJiraIssue + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +JiraIntegrationApiService Get changesets for issue key +Retrieve a page of changesets associated with the given issue key. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param issueKey The issue key to search by + * @param optional nil or *JiraIntegrationApiGetCommitsByIssueKeyOpts - Optional Parameters: + * @param "MaxChanges" (optional.String) - The maximum number of changes to retrieve for each changeset + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2006 +*/ + +type JiraIntegrationApiGetCommitsByIssueKeyOpts struct { + MaxChanges optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *JiraIntegrationApiService) GetCommitsByIssueKey(ctx context.Context, issueKey string, localVarOptionals *JiraIntegrationApiGetCommitsByIssueKeyOpts) (InlineResponse2006, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2006 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/jira/latest/issues/{issueKey}/commits" + localVarPath = strings.Replace(localVarPath, "{"+"issueKey"+"}", fmt.Sprintf("%v", issueKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.MaxChanges.IsSet() { + localVarQueryParams.Add("maxChanges", parameterToString(localVarOptionals.MaxChanges.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2006 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +JiraIntegrationApiService Get entity link +Retrieves the enchanced primary entitylink The authenticated user must have <strong>PROJECT_READ</strong> permission for the project having the primary enhanced entitylink. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key +@return RestEnhancedEntityLink +*/ +func (a *JiraIntegrationApiService) GetEnhancedEntityLinkForProject(ctx context.Context, projectKey string) (RestEnhancedEntityLink, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestEnhancedEntityLink + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/jira/latest/projects/{projectKey}/primary-enhanced-entitylink" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestEnhancedEntityLink + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +JiraIntegrationApiService Get issues for a pull request +Retrieves Jira issue keys that are associated with the commits in the specified pull request. The number of commits checked for issues is limited to a default of 100. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param pullRequestId The pull request id + * @param repositorySlug The repository slug +@return []RestJiraIssue +*/ +func (a *JiraIntegrationApiService) GetIssueKeysForPullRequest(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) ([]RestJiraIssue, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []RestJiraIssue + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/jira/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/issues" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v []RestJiraIssue + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_markup.go b/vendor/github.com/gdasson/bitbucketv1go/api_markup.go new file mode 100644 index 000000000..86aa9aed8 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_markup.go @@ -0,0 +1,162 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type MarkupApiService service +/* +MarkupApiService Preview markdown render +Preview generated HTML for the given markdown content. Only authenticated users may call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *MarkupApiPreviewOpts - Optional Parameters: + * @param "Body" (optional.Interface of string) - + * @param "HtmlEscape" (optional.String) - (Optional) true if HTML should be escaped in the input markup, false otherwise. + * @param "UrlMode" (optional.String) - (Optional) The mode to use when building URLs. One of: ABSOLUTE, RELATIVE or, CONFIGURED. By default this is RELATIVE. + * @param "IncludeHeadingId" (optional.String) - (Optional) true if headers should contain an ID based on the heading content. + * @param "Hardwrap" (optional.String) - (Optional) Whether the markup implementation should convert newlines to breaks. By default this is false which reflects the standard markdown specification. +@return RestMarkup +*/ + +type MarkupApiPreviewOpts struct { + Body optional.Interface + HtmlEscape optional.String + UrlMode optional.String + IncludeHeadingId optional.String + Hardwrap optional.String +} + +func (a *MarkupApiService) Preview(ctx context.Context, localVarOptionals *MarkupApiPreviewOpts) (RestMarkup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMarkup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/markup/preview" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.HtmlEscape.IsSet() { + localVarQueryParams.Add("htmlEscape", parameterToString(localVarOptionals.HtmlEscape.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.UrlMode.IsSet() { + localVarQueryParams.Add("urlMode", parameterToString(localVarOptionals.UrlMode.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludeHeadingId.IsSet() { + localVarQueryParams.Add("includeHeadingId", parameterToString(localVarOptionals.IncludeHeadingId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Hardwrap.IsSet() { + localVarQueryParams.Add("hardwrap", parameterToString(localVarOptionals.Hardwrap.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMarkup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_mirroring_mirror.go b/vendor/github.com/gdasson/bitbucketv1go/api_mirroring_mirror.go new file mode 100644 index 000000000..04a518cf7 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_mirroring_mirror.go @@ -0,0 +1,1790 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type MirroringMirrorApiService service +/* +MirroringMirrorApiService Get farm nodes +Retrieves the list of farm nodes in this cluster + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId the upstream server ID to retrieve settings for +@return []RestClusterNode +*/ +func (a *MirroringMirrorApiService) GetFarmNodes(ctx context.Context, upstreamId string) ([]RestClusterNode, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []RestClusterNode + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/farmNodes" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v []RestClusterNode + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v RestErrors + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get mirror mode +Gets the current mirror mode for the specified upstream + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId + +*/ +func (a *MirroringMirrorApiService) GetMirrorMode(ctx context.Context, upstreamId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/settings/mode" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get upstream settings +Retrieves upstream settings + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId +@return RestUpstreamSettings +*/ +func (a *MirroringMirrorApiService) GetMirrorSettings(ctx context.Context, upstreamId string) (RestUpstreamSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestUpstreamSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/settings" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestUpstreamSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get mirrored project IDs +Returns the IDs of the projects that the mirror is configured to mirror + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId + +*/ +func (a *MirroringMirrorApiService) GetMirroredProjects(ctx context.Context, upstreamId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/settings/projects" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get clone URLs +Retrieves all available clone urls for the specified repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamRepoId the repository ID + * @param upstreamId the upstream server ID +@return RestMirroredRepository +*/ +func (a *MirroringMirrorApiService) GetMirroredRepository(ctx context.Context, upstreamRepoId string, upstreamId string) (RestMirroredRepository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMirroredRepository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/repos/{upstreamRepoId}" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamRepoId"+"}", fmt.Sprintf("%v", upstreamRepoId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMirroredRepository + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get items in ref changes queue +Retrieves a list of up to <code>plugin.mirroring.farm.max.ref.change.queue.dump.size</code> items currently in the ref changes queue. The ref changes queue is an internal component of every mirror farm, and is shared between all nodes. When the contents of an upstream repository changes, an item is added to this queue so that the mirror farm nodes know to synchronize. The mirror farm constantly polls and removes items from this queue for processing, so it is empty most of the time. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestRefSyncQueue +*/ +func (a *MirroringMirrorApiService) GetRefChangesQueue(ctx context.Context) (RestRefSyncQueue, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRefSyncQueue + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/supportInfo/refChangesQueue" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRefSyncQueue + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get total number of items in ref changes queue +Retrieves the total number of items currently in the ref changes queue + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *MirroringMirrorApiService) GetRefChangesQueueCount(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/supportInfo/refChangesQueue/count" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get sync status of repositories +Retrieves a page of sync statuses of the repositories on this mirror node + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *MirroringMirrorApiGetRepoSyncStatusOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2008 +*/ + +type MirroringMirrorApiGetRepoSyncStatusOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *MirroringMirrorApiService) GetRepoSyncStatus(ctx context.Context, localVarOptionals *MirroringMirrorApiGetRepoSyncStatusOpts) (InlineResponse2008, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2008 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/supportInfo/repoSyncStatus" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2008 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get synchronization progress state + Retrieves synchronization progress state for the specified upstream server.If there's no progress to report, this resource will return <pre><code> {\"discovering\":false,\"syncedRepos\":0,\"totalRepos\":0}</code></pre> If there are repositories in the process of synchronizing, but the precise number hasn't been discovered yet, this resource will return: <pre><code> {\"discovering\":true,\"syncedRepos\":3,\"totalRepos\":100}</code></pre> If there is progress to report and the total number of repositories is known, this resource will return: <pre> <code> {\"discovering\":false,\"syncedRepos\":242,\"totalRepos\":1071}</code> </pre> + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId the upstream server ID to retrieve settings for +@return RestSyncProgress +*/ +func (a *MirroringMirrorApiService) GetSynchronizationProgress(ctx context.Context, upstreamId string) (RestSyncProgress, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSyncProgress + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/progress" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSyncProgress + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get upstream server by ID +Retrieves upstream server details by ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId The upstream server ID to retrieve settings for. +@return RestUpstreamServer +*/ +func (a *MirroringMirrorApiService) GetUpstreamServer(ctx context.Context, upstreamId string) (RestUpstreamServer, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestUpstreamServer + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestUpstreamServer + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get upstream servers +Retrieves a page of upstream servers + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *MirroringMirrorApiListUpstreamServersOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2009 +*/ + +type MirroringMirrorApiListUpstreamServersOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *MirroringMirrorApiService) ListUpstreamServers(ctx context.Context, localVarOptionals *MirroringMirrorApiListUpstreamServersOpts) (InlineResponse2009, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2009 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2009 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringMirrorApiService On disable of mirror addon +This REST endpoint is retained for backwards compatibility only. It is a no-op. Starting from 4.6.0, mirrors no longer specify a disabled lifecycle callback in their addon descriptor. Prior to 4.6.0, this was the callback method that was called when the mirroring atlassian-connect add-on has been disabled in the upstream server identified by <code> upstreamId</code>. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId the upstream server ID to retrieve settings for + +*/ +func (a *MirroringMirrorApiService) OnAddonDisabled(ctx context.Context, upstreamId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/addon/disabled" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService On enabled of mirror addon +This REST endpoint is retained for backwards compatibility only. It is a no-op. Starting from 4.6.0, mirrors no longer specify an enabled lifecycle callback in their addon descriptor. Prior to 4.6.0, this was the callback method that was called when the mirroring atlassian-connect add-on has been enabled in the upstream server identified by <code>upstreamId</code>. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId the upstream server ID to retrieve settings for + +*/ +func (a *MirroringMirrorApiService) OnAddonEnabled(ctx context.Context, upstreamId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/addon/enabled" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Update mirror mode +Sets the mirror mode for the specified upstream + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId + * @param optional nil or *MirroringMirrorApiSetMirrorModeOpts - Optional Parameters: + * @param "Body" (optional.Interface of string) - + +*/ + +type MirroringMirrorApiSetMirrorModeOpts struct { + Body optional.Interface +} + +func (a *MirroringMirrorApiService) SetMirrorMode(ctx context.Context, upstreamId string, localVarOptionals *MirroringMirrorApiSetMirrorModeOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/settings/mode" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Update upstream settings +Sets the settings for the specified upstream + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId + * @param optional nil or *MirroringMirrorApiSetMirrorSettingsOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestUpstreamSettings) - the mirror settings to update to +@return RestUpstreamSettings +*/ + +type MirroringMirrorApiSetMirrorSettingsOpts struct { + Body optional.Interface +} + +func (a *MirroringMirrorApiService) SetMirrorSettings(ctx context.Context, upstreamId string, localVarOptionals *MirroringMirrorApiSetMirrorSettingsOpts) (RestUpstreamSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestUpstreamSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/settings" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestUpstreamSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Add project to be mirrored +Configures the mirror to mirror the provided project + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId + * @param projectId + +*/ +func (a *MirroringMirrorApiService) StartMirroringProject(ctx context.Context, upstreamId string, projectId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/settings/projects/{projectId}" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", fmt.Sprintf("%v", projectId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Add multiple projects to be mirrored +Configures the mirror to mirror the provided projects + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId + * @param optional nil or *MirroringMirrorApiStartMirroringProjectsOpts - Optional Parameters: + * @param "Body" (optional.Interface of []string) - + +*/ + +type MirroringMirrorApiStartMirroringProjectsOpts struct { + Body optional.Interface +} + +func (a *MirroringMirrorApiService) StartMirroringProjects(ctx context.Context, upstreamId string, localVarOptionals *MirroringMirrorApiStartMirroringProjectsOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/settings/projects" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Stop mirroring project +Configures the mirror to no longer mirror the provided project + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId + * @param projectId the project ID to stop mirroring + +*/ +func (a *MirroringMirrorApiService) StopMirroringProject(ctx context.Context, upstreamId string, projectId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/settings/projects/{projectId}" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", fmt.Sprintf("%v", projectId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Stop mirroring projects +Configures the mirror to no longer mirror the provided projects + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId + * @param optional nil or *MirroringMirrorApiStopMirroringProjectsOpts - Optional Parameters: + * @param "Body" (optional.Interface of []string) - + +*/ + +type MirroringMirrorApiStopMirroringProjectsOpts struct { + Body optional.Interface +} + +func (a *MirroringMirrorApiService) StopMirroringProjects(ctx context.Context, upstreamId string, localVarOptionals *MirroringMirrorApiStopMirroringProjectsOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/settings/projects" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Get upstream settings +This method is no longer supported + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamRepoId + * @param upstreamId the upstream server ID to retrieve settings for + * @param optional nil or *MirroringMirrorApiSynchronizeRepositoryWithUpstreamOpts - Optional Parameters: + * @param "Level" (optional.String) - the level of synchronization to perform + +*/ + +type MirroringMirrorApiSynchronizeRepositoryWithUpstreamOpts struct { + Level optional.String +} + +func (a *MirroringMirrorApiService) SynchronizeRepositoryWithUpstream(ctx context.Context, upstreamRepoId string, upstreamId string, localVarOptionals *MirroringMirrorApiSynchronizeRepositoryWithUpstreamOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/repos/{upstreamRepoId}/synchronization" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamRepoId"+"}", fmt.Sprintf("%v", upstreamRepoId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Level.IsSet() { + localVarQueryParams.Add("level", parameterToString(localVarOptionals.Level.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringMirrorApiService Change upstream settings +This method is no longer supported + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param upstreamId the upstream server ID to retrieve settings for + * @param optional nil or *MirroringMirrorApiSynchronizeWithUpstreamOpts - Optional Parameters: + * @param "Level" (optional.String) - + +*/ + +type MirroringMirrorApiSynchronizeWithUpstreamOpts struct { + Level optional.String +} + +func (a *MirroringMirrorApiService) SynchronizeWithUpstream(ctx context.Context, upstreamId string, localVarOptionals *MirroringMirrorApiSynchronizeWithUpstreamOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/upstreamServers/{upstreamId}/synchronization" + localVarPath = strings.Replace(localVarPath, "{"+"upstreamId"+"}", fmt.Sprintf("%v", upstreamId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Level.IsSet() { + localVarQueryParams.Add("level", parameterToString(localVarOptionals.Level.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_mirroring_upstream.go b/vendor/github.com/gdasson/bitbucketv1go/api_mirroring_upstream.go new file mode 100644 index 000000000..cb5593cb0 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_mirroring_upstream.go @@ -0,0 +1,2077 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type MirroringUpstreamApiService service +/* +MirroringUpstreamApiService Accept a mirroring request +Accepts a mirroring request + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param mirroringRequestId the ID of the request to accept +@return RestMirrorServer +*/ +func (a *MirroringUpstreamApiService) Accept(ctx context.Context, mirroringRequestId string) (RestMirrorServer, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMirrorServer + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/requests/{mirroringRequestId}/accept" + localVarPath = strings.Replace(localVarPath, "{"+"mirroringRequestId"+"}", fmt.Sprintf("%v", mirroringRequestId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMirrorServer + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get analytics settings from upstream +Gets the analytics settings from the mirroring upstream + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestAnalyticsSettings +*/ +func (a *MirroringUpstreamApiService) AnalyticsSettings(ctx context.Context) (RestAnalyticsSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAnalyticsSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/analyticsSettings" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAnalyticsSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Authenticate on behalf of a user +Authenticates on behalf of a user. Used by mirrors to check the credentials supplied to them by users. If successful a user and their effective permissions are returned as follows - * For SSH credentials - all the effective user permissions are returned. * For all other credentials - the highest global permission is returned along with highest repository permission if repository ID is also provided in the request. Currently only username/password, bearer token and SSH credentials are supported. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *MirroringUpstreamApiAuthenticateOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestAuthenticationRequest) - +@return RestApplicationUserWithPermissions +*/ + +type MirroringUpstreamApiAuthenticateOpts struct { + Body optional.Interface +} + +func (a *MirroringUpstreamApiService) Authenticate(ctx context.Context, localVarOptionals *MirroringUpstreamApiAuthenticateOpts) (RestApplicationUserWithPermissions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestApplicationUserWithPermissions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/authenticate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestApplicationUserWithPermissions + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Delete a mirroring request +Deletes a mirroring request + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param mirroringRequestId the ID of the mirroring request to delete + +*/ +func (a *MirroringUpstreamApiService) DeleteMirroringRequest(ctx context.Context, mirroringRequestId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/requests/{mirroringRequestId}" + localVarPath = strings.Replace(localVarPath, "{"+"mirroringRequestId"+"}", fmt.Sprintf("%v", mirroringRequestId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Remove preferred mirror +Removes the current user's preferred mirror + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *MirroringUpstreamApiService) DeletePreferredMirrorId(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/account/settings/preferred-mirror" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get content hashes for repositories +Returns a page of repositories enriched with a content hash and default branch + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *MirroringUpstreamApiGetAllContentHashesOpts - Optional Parameters: + * @param "IncludeDefaultBranch" (optional.String) - includes defaultBranchId for each repository in the response, if <code>true</code>. Default value is <code>false</code>. +@return EnrichedRepository +*/ + +type MirroringUpstreamApiGetAllContentHashesOpts struct { + IncludeDefaultBranch optional.String +} + +func (a *MirroringUpstreamApiService) GetAllContentHashes(ctx context.Context, localVarOptionals *MirroringUpstreamApiGetAllContentHashesOpts) (EnrichedRepository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue EnrichedRepository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/repos" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.IncludeDefaultBranch.IsSet() { + localVarQueryParams.Add("includeDefaultBranch", parameterToString(localVarOptionals.IncludeDefaultBranch.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v EnrichedRepository + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get hashes for repositories in project +Returns a page of repositories for a given project, enriched with a content hash + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectId the id of the requested project + * @param optional nil or *MirroringUpstreamApiGetAllReposForProjectOpts - Optional Parameters: + * @param "IncludeDefaultBranch" (optional.String) - includes defaultBranchId in the response, if <code>true</code>. Default value is <code>false</code> + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20011 +*/ + +type MirroringUpstreamApiGetAllReposForProjectOpts struct { + IncludeDefaultBranch optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *MirroringUpstreamApiService) GetAllReposForProject(ctx context.Context, projectId string, localVarOptionals *MirroringUpstreamApiGetAllReposForProjectOpts) (InlineResponse20011, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20011 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/projects/{projectId}/repos" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", fmt.Sprintf("%v", projectId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.IncludeDefaultBranch.IsSet() { + localVarQueryParams.Add("includeDefaultBranch", parameterToString(localVarOptionals.IncludeDefaultBranch.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20011 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get content hash for a repository +Returns a repository enriched with a content hash and default branch + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param repoId the ID of the requested repository + * @param optional nil or *MirroringUpstreamApiGetContentHashByIdOpts - Optional Parameters: + * @param "IncludeDefaultBranch" (optional.Bool) - +@return EnrichedRepository +*/ + +type MirroringUpstreamApiGetContentHashByIdOpts struct { + IncludeDefaultBranch optional.Bool +} + +func (a *MirroringUpstreamApiService) GetContentHashById(ctx context.Context, repoId string, localVarOptionals *MirroringUpstreamApiGetContentHashByIdOpts) (EnrichedRepository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue EnrichedRepository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/repos/{repoId}" + localVarPath = strings.Replace(localVarPath, "{"+"repoId"+"}", fmt.Sprintf("%v", repoId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.IncludeDefaultBranch.IsSet() { + localVarQueryParams.Add("includeDefaultBranch", parameterToString(localVarOptionals.IncludeDefaultBranch.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v EnrichedRepository + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get mirror by ID +Returns the mirror specified by a mirror ID + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param mirrorId the mirror ID +@return RestMirrorServer +*/ +func (a *MirroringUpstreamApiService) GetMirror(ctx context.Context, mirrorId string) (RestMirrorServer, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMirrorServer + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/mirrorServers/{mirrorId}" + localVarPath = strings.Replace(localVarPath, "{"+"mirrorId"+"}", fmt.Sprintf("%v", mirrorId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMirrorServer + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get a mirroring request +Retrieves a mirroring request + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param mirroringRequestId the ID of the mirroring request to retrieve +@return RestMirroringRequest +*/ +func (a *MirroringUpstreamApiService) GetMirroringRequest(ctx context.Context, mirroringRequestId string) (RestMirroringRequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMirroringRequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/requests/{mirroringRequestId}" + localVarPath = strings.Replace(localVarPath, "{"+"mirroringRequestId"+"}", fmt.Sprintf("%v", mirroringRequestId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMirroringRequest + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get HTML for remote-connect web-panel on mirror +Gets the rendered HTML that is needed to get the remote connect web-panel on the mirror. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param mirrorId + +*/ +func (a *MirroringUpstreamApiService) GetPanelHtml(ctx context.Context, mirrorId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/mirrorServers/{mirrorId}/webPanels/config" + localVarPath = strings.Replace(localVarPath, "{"+"mirrorId"+"}", fmt.Sprintf("%v", mirrorId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"text/html"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get preferred mirror +Retrieves the current user's preferred mirror server + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestMirrorServer +*/ +func (a *MirroringUpstreamApiService) GetPreferredMirrorId(ctx context.Context) (RestMirrorServer, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMirrorServer + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/account/settings/preferred-mirror" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMirrorServer + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get project +Returns the requested project using its primary key ID.<br> Since 6.7 + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectId the ID of the requested project +@return RestProject +*/ +func (a *MirroringUpstreamApiService) GetProjectById(ctx context.Context, projectId string) (RestProject, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestProject + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/projects/{projectId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", fmt.Sprintf("%v", projectId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestProject + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get mirrors for repository +Returns a page of mirrors for a repository. This resource will return <strong>all mirrors</strong> along with authorized links to the mirror's repository REST resource. To determine if a repository is available on the mirror, the returned URL needs to be called. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param repoId the ID of the requested repository +@return RestMirroredRepositoryDescriptor +*/ +func (a *MirroringUpstreamApiService) GetRepositoryMirrors(ctx context.Context, repoId string) (RestMirroredRepositoryDescriptor, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMirroredRepositoryDescriptor + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/repos/{repoId}/mirrors" + localVarPath = strings.Replace(localVarPath, "{"+"repoId"+"}", fmt.Sprintf("%v", repoId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMirroredRepositoryDescriptor + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get all mirrors +Returns a list of mirrors + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *MirroringUpstreamApiListMirrorsOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20010 +*/ + +type MirroringUpstreamApiListMirrorsOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *MirroringUpstreamApiService) ListMirrors(ctx context.Context, localVarOptionals *MirroringUpstreamApiListMirrorsOpts) (InlineResponse20010, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20010 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/mirrorServers" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20010 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Get mirroring requests +Retrieves a mirroring request + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *MirroringUpstreamApiListRequestsOpts - Optional Parameters: + * @param "State" (optional.String) - (optional) the request state to filter on + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20012 +*/ + +type MirroringUpstreamApiListRequestsOpts struct { + State optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *MirroringUpstreamApiService) ListRequests(ctx context.Context, localVarOptionals *MirroringUpstreamApiListRequestsOpts) (InlineResponse20012, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20012 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/requests" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.State.IsSet() { + localVarQueryParams.Add("state", parameterToString(localVarOptionals.State.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20012 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Publish RepositoryMirrorEvent +Publishes a RepositoryMirrorEvent on the event queue. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param mirrorId the server id of the mirror that raised this event + * @param optional nil or *MirroringUpstreamApiPublishEventOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestRepositoryMirrorEvent) - + +*/ + +type MirroringUpstreamApiPublishEventOpts struct { + Body optional.Interface +} + +func (a *MirroringUpstreamApiService) PublishEvent(ctx context.Context, mirrorId string, localVarOptionals *MirroringUpstreamApiPublishEventOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/mirrorServers/{mirrorId}/events" + localVarPath = strings.Replace(localVarPath, "{"+"mirrorId"+"}", fmt.Sprintf("%v", mirrorId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Create a mirroring request +Creates a new mirroring request + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *MirroringUpstreamApiRegisterOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestMirroringRequest) - +@return RestMirroringRequest +*/ + +type MirroringUpstreamApiRegisterOpts struct { + Body optional.Interface +} + +func (a *MirroringUpstreamApiService) Register(ctx context.Context, localVarOptionals *MirroringUpstreamApiRegisterOpts) (RestMirroringRequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMirroringRequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/requests" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMirroringRequest + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Reject a mirroring request +Rejects a mirroring request + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param mirroringRequestId the ID of the request to reject +@return RestMirrorServer +*/ +func (a *MirroringUpstreamApiService) Reject(ctx context.Context, mirroringRequestId string) (RestMirrorServer, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMirrorServer + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/requests/{mirroringRequestId}/reject" + localVarPath = strings.Replace(localVarPath, "{"+"mirroringRequestId"+"}", fmt.Sprintf("%v", mirroringRequestId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMirrorServer + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Delete mirror by ID +Removes a mirror, disabling all access and notifications for the mirror server in question + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param mirrorId the ID of the mirror to remove + +*/ +func (a *MirroringUpstreamApiService) Remove(ctx context.Context, mirrorId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/mirrorServers/{mirrorId}" + localVarPath = strings.Replace(localVarPath, "{"+"mirrorId"+"}", fmt.Sprintf("%v", mirrorId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Set preferred mirror +Sets the mirror specified by a mirror ID as the current user's preferred mirror + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *MirroringUpstreamApiSetPreferredMirrorIdOpts - Optional Parameters: + * @param "Body" (optional.Interface of string) - the mirror ID + +*/ + +type MirroringUpstreamApiSetPreferredMirrorIdOpts struct { + Body optional.Interface +} + +func (a *MirroringUpstreamApiService) SetPreferredMirrorId(ctx context.Context, localVarOptionals *MirroringUpstreamApiSetPreferredMirrorIdOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/account/settings/preferred-mirror" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +MirroringUpstreamApiService Upgrade add-on for a mirror +Upgrades the add-on for the mirror server in question This endpoint can only be called by the mirror instance or system administrators<br>Since 5.8 + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param mirrorId the ID of the mirror to upgrade + * @param optional nil or *MirroringUpstreamApiUpgradeOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestMirrorUpgradeRequest) - +@return RestMirrorServer +*/ + +type MirroringUpstreamApiUpgradeOpts struct { + Body optional.Interface +} + +func (a *MirroringUpstreamApiService) Upgrade(ctx context.Context, mirrorId string, localVarOptionals *MirroringUpstreamApiUpgradeOpts) (RestMirrorServer, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMirrorServer + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/mirroring/latest/mirrorServers/{mirrorId}" + localVarPath = strings.Replace(localVarPath, "{"+"mirrorId"+"}", fmt.Sprintf("%v", mirrorId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMirrorServer + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_permission_management.go b/vendor/github.com/gdasson/bitbucketv1go/api_permission_management.go new file mode 100644 index 000000000..96b1aa071 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_permission_management.go @@ -0,0 +1,4835 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type PermissionManagementApiService service +/* +PermissionManagementApiService Add user to group +<strong>Deprecated since 2.10</strong>. Use /rest/users/add-groups instead. Add a user to a group. This is very similar to <code>groups/add-user</code>, but with the <em>context</em> and <em>itemName</em> attributes of the supplied request entity reversed. On the face of it this may appear redundant, but it facilitates a specific UI component in the application. In the request entity, the <em>context</em> attribute is the user and the <em>itemName</em> is the group. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiAddGroupToUserOpts - Optional Parameters: + * @param "Body" (optional.Interface of GroupPickerContext) - + +*/ + +type PermissionManagementApiAddGroupToUserOpts struct { + Body optional.Interface +} + +func (a *PermissionManagementApiService) AddGroupToUser(ctx context.Context, localVarOptionals *PermissionManagementApiAddGroupToUserOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/add-group" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Add user to group +<strong>Deprecated since 2.10</strong>. Use /rest/users/add-groups instead. Add a user to a group. In the request entity, the <em>context</em> attribute is the group and the <em>itemName</em> is the user. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiAddUserToGroupOpts - Optional Parameters: + * @param "Body" (optional.Interface of UserPickerContext) - + +*/ + +type PermissionManagementApiAddUserToGroupOpts struct { + Body optional.Interface +} + +func (a *PermissionManagementApiService) AddUserToGroup(ctx context.Context, localVarOptionals *PermissionManagementApiAddUserToGroupOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/groups/add-user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Add user to groups +Add a user to one or more groups. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiAddUserToGroupsOpts - Optional Parameters: + * @param "Body" (optional.Interface of UserAndGroups) - + +*/ + +type PermissionManagementApiAddUserToGroupsOpts struct { + Body optional.Interface +} + +func (a *PermissionManagementApiService) AddUserToGroups(ctx context.Context, localVarOptionals *PermissionManagementApiAddUserToGroupsOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/add-groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Add multiple users to group +Add multiple users to a group. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiAddUsersToGroupOpts - Optional Parameters: + * @param "Body" (optional.Interface of GroupAndUsers) - + +*/ + +type PermissionManagementApiAddUsersToGroupOpts struct { + Body optional.Interface +} + +func (a *PermissionManagementApiService) AddUsersToGroup(ctx context.Context, localVarOptionals *PermissionManagementApiAddUsersToGroupOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/groups/add-users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Clear CAPTCHA for user +Clears any CAPTCHA challenge that may constrain the user with the supplied username when they authenticate. Additionally any counter or metric that contributed towards the user being issued the CAPTCHA challenge (for instance too many consecutive failed logins) will also be reset. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource, and may not clear the CAPTCHA of a user with greater permissions than themselves. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The username + +*/ +func (a *PermissionManagementApiService) ClearUserCaptchaChallenge(ctx context.Context, name string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/captcha" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("name", parameterToString(name, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Create group +Create a new group. The authenticated user must have <strong>ADMIN</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name Name of the group. +@return RestDetailedGroup +*/ +func (a *PermissionManagementApiService) CreateGroup(ctx context.Context, name string) (RestDetailedGroup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestDetailedGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("name", parameterToString(name, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestDetailedGroup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Create user +Creates a new user from the assembled query parameters. The default group can be used to control initial permissions for new users, such as granting users the ability to login or providing read access to certain projects or repositories. If the user is not added to the default group, they may not be able to login after their account is created until explicit permissions are configured. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param emailAddress The e-mail address for the new user. + * @param displayName The display name for the new user. + * @param name The username for the new user. + * @param optional nil or *PermissionManagementApiCreateUserOpts - Optional Parameters: + * @param "Password" (optional.String) - The password for the new user. Required if the <code>notify</code> parameter is not present or is set to <code>false</false> + * @param "AddToDefaultGroup" (optional.Bool) - Set <code>true</code> to add the user to the default group, which can be used to grant them a set of initial permissions; otherwise, <code>false</code> to not add them to a group. + * @param "Notify" (optional.Bool) - If present and not <code>false</code> instead of requiring a password, the create user will be notified via email their account has been created and requires a password to be reset. This option can only be used if a mail server has been configured. + +*/ + +type PermissionManagementApiCreateUserOpts struct { + Password optional.String + AddToDefaultGroup optional.Bool + Notify optional.Bool +} + +func (a *PermissionManagementApiService) CreateUser(ctx context.Context, emailAddress string, displayName string, name string, localVarOptionals *PermissionManagementApiCreateUserOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("emailAddress", parameterToString(emailAddress, "")) + if localVarOptionals != nil && localVarOptionals.Password.IsSet() { + localVarQueryParams.Add("password", parameterToString(localVarOptionals.Password.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AddToDefaultGroup.IsSet() { + localVarQueryParams.Add("addToDefaultGroup", parameterToString(localVarOptionals.AddToDefaultGroup.Value(), "")) + } + localVarQueryParams.Add("displayName", parameterToString(displayName, "")) + localVarQueryParams.Add("name", parameterToString(name, "")) + if localVarOptionals != nil && localVarOptionals.Notify.IsSet() { + localVarQueryParams.Add("notify", parameterToString(localVarOptionals.Notify.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Remove group +Deletes the specified group, removing them from the system. This also removes any permissions that may have been granted to the group. A user may not delete the last group that is granting them administrative permissions, or a group with greater permissions than themselves. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The name identifying the group to delete. +@return RestDetailedGroup +*/ +func (a *PermissionManagementApiService) DeleteGroup(ctx context.Context, name string) (RestDetailedGroup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestDetailedGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("name", parameterToString(name, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestDetailedGroup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Remove user +Deletes the specified user, removing them from the system. This also removes any permissions that may have been granted to the user. A user may not delete themselves, and a user with <strong>ADMIN</strong> permissions may not delete a user with <strong>SYS_ADMIN</strong>permissions. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The username identifying the user to delete. +@return RestDetailedUser +*/ +func (a *PermissionManagementApiService) DeleteUser(ctx context.Context, name string) (RestDetailedUser, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestDetailedUser + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("name", parameterToString(name, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestDetailedUser + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Erase user information +Erases personally identifying user data for a deleted user. References in the application to the original username will be either removed or updated to a new non-identifying username. Refer to the <a href=\"https://confluence.atlassian.com/gdpr/bitbucket-right-to-erasure-949770560.html\">support guide</a> for details about what data is and isn't erased. User erasure can only be performed on a deleted user. If the user has not been deleted first then this endpoint will return a bad request and no erasure will be performed. Erasing user data is <strong>irreversible</strong> and may lead to a degraded user experience. This method should not be used as part of a standard user deletion and cleanup process. Plugins can participate in user erasure by defining a <code>&lt;user-erasure-handler&gt;</code> module. If one or more plugin modules fail, an error summary of the failing modules is returned. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The username identifying the user to erase. +@return RestErasedUser +*/ +func (a *PermissionManagementApiService) EraseUser(ctx context.Context, name string) (RestErasedUser, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestErasedUser + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/erasure" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("name", parameterToString(name, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestErasedUser + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get groups for user +Retrieves a list of users that are <em>not</em> members of a specified group. <p>The authenticated user must have the <strong>LICENSED_USER</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param context The group which should be used to locate members. + * @param optional nil or *PermissionManagementApiFindGroupsForUserOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only users with usernames, display names or email addresses containing the supplied string will be returned. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20017 +*/ + +type PermissionManagementApiFindGroupsForUserOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) FindGroupsForUser(ctx context.Context, context string, localVarOptionals *PermissionManagementApiFindGroupsForUserOpts) (InlineResponse20017, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20017 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/more-members" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + localVarQueryParams.Add("context", parameterToString(context, "")) + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20017 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Find other groups for user +Retrieves a list of groups the specified user is <em>not</em> a member of. <p>The authenticated user must have the <strong>LICENSED_USER</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param context The user which should be used to locate groups. + * @param optional nil or *PermissionManagementApiFindOtherGroupsForUserOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only groups with names containing the supplied string will be returned. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20016 +*/ + +type PermissionManagementApiFindOtherGroupsForUserOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) FindOtherGroupsForUser(ctx context.Context, context string, localVarOptionals *PermissionManagementApiFindOtherGroupsForUserOpts) (InlineResponse20016, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20016 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/more-non-members" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + localVarQueryParams.Add("context", parameterToString(context, "")) + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20016 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get group members +Retrieves a list of users that are members of a specified group. <p>The authenticated user must have the <strong>LICENSED_USER</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param context The group which should be used to locate members. + * @param optional nil or *PermissionManagementApiFindUsersInGroupOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only users with usernames, display names or email addresses containing the supplied string will be returned. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20017 +*/ + +type PermissionManagementApiFindUsersInGroupOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) FindUsersInGroup(ctx context.Context, context string, localVarOptionals *PermissionManagementApiFindUsersInGroupOpts) (InlineResponse20017, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20017 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/groups/more-members" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + localVarQueryParams.Add("context", parameterToString(context, "")) + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20017 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get members not in group +Retrieves a list of users that are <em>not</em> members of a specified group. <p>The authenticated user must have the <strong>LICENSED_USER</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param context The group which should be used to locate members. + * @param optional nil or *PermissionManagementApiFindUsersNotInGroupOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only users with usernames, display names or email addresses containing the supplied string will be returned. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20017 +*/ + +type PermissionManagementApiFindUsersNotInGroupOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) FindUsersNotInGroup(ctx context.Context, context string, localVarOptionals *PermissionManagementApiFindUsersNotInGroupOpts) (InlineResponse20017, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20017 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/groups/more-non-members" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + localVarQueryParams.Add("context", parameterToString(context, "")) + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20017 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get group names +Retrieve a page of group names. The authenticated user must have <strong>LICENSED_USER</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiGetGroupsOpts - Optional Parameters: + * @param "Filter" (optional.String) - + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20023 +*/ + +type PermissionManagementApiGetGroupsOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetGroups(ctx context.Context, localVarOptionals *PermissionManagementApiGetGroupsOpts) (InlineResponse20023, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20023 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20023 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get groups +Retrieve a page of groups. The authenticated user must have <strong>LICENSED_USER</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiGetGroups1Opts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only group names containing the supplied string will be returned. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20016 +*/ + +type PermissionManagementApiGetGroups1Opts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetGroups1(ctx context.Context, localVarOptionals *PermissionManagementApiGetGroups1Opts) (InlineResponse20016, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20016 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20016 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get groups with a global permission +Retrieve a page of groups that have been granted at least one global permission. The authenticated user must have <strong>ADMIN</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiGetGroupsWithAnyPermissionOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only group names containing the supplied string will be returned + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20018 +*/ + +type PermissionManagementApiGetGroupsWithAnyPermissionOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetGroupsWithAnyPermission(ctx context.Context, localVarOptionals *PermissionManagementApiGetGroupsWithAnyPermissionOpts) (InlineResponse20018, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20018 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/permissions/groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20018 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get groups with permission to repository +Retrieve a page of groups that have been granted at least one permission for the specified repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository or a higher project or global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PermissionManagementApiGetGroupsWithAnyPermission2Opts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only group names containing the supplied string will be returned. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20018 +*/ + +type PermissionManagementApiGetGroupsWithAnyPermission2Opts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetGroupsWithAnyPermission2(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PermissionManagementApiGetGroupsWithAnyPermission2Opts) (InlineResponse20018, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20018 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/groups" + 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 localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20018 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get groups with no global permission +Retrieve a page of groups that have no granted global permissions. The authenticated user must have <strong>ADMIN</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiGetGroupsWithoutAnyPermissionOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only user names containing the supplied string will be returned + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20016 +*/ + +type PermissionManagementApiGetGroupsWithoutAnyPermissionOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetGroupsWithoutAnyPermission(ctx context.Context, localVarOptionals *PermissionManagementApiGetGroupsWithoutAnyPermissionOpts) (InlineResponse20016, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20016 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/permissions/groups/none" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20016 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get groups without repository permission +Retrieve a page of groups that have no granted permissions for the specified repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository or a higher project or global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PermissionManagementApiGetGroupsWithoutAnyPermission2Opts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only group names containing the supplied string will be returned. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20016 +*/ + +type PermissionManagementApiGetGroupsWithoutAnyPermission2Opts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetGroupsWithoutAnyPermission2(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PermissionManagementApiGetGroupsWithoutAnyPermission2Opts) (InlineResponse20016, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20016 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/groups/none" + 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 localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20016 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get directories +Retrieve a list of active directories. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiGetUserDirectoriesOpts - Optional Parameters: + * @param "IncludeInactive" (optional.String) - Set <code>true</code> to include inactive directories; otherwise, <code>false</code> to only return active directories. +@return RestUserDirectory +*/ + +type PermissionManagementApiGetUserDirectoriesOpts struct { + IncludeInactive optional.String +} + +func (a *PermissionManagementApiService) GetUserDirectories(ctx context.Context, localVarOptionals *PermissionManagementApiGetUserDirectoriesOpts) (RestUserDirectory, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestUserDirectory + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/user-directories" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.IncludeInactive.IsSet() { + localVarQueryParams.Add("includeInactive", parameterToString(localVarOptionals.IncludeInactive.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestUserDirectory + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get users +Retrieve a page of users. The authenticated user must have the <strong>LICENSED_USER</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiGetUsers1Opts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only users with usernames, display name or email addresses containing the supplied string will be returned. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20017 +*/ + +type PermissionManagementApiGetUsers1Opts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetUsers1(ctx context.Context, localVarOptionals *PermissionManagementApiGetUsers1Opts) (InlineResponse20017, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20017 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20017 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get users with a global permission +Retrieve a page of users that have been granted at least one global permission. The authenticated user must have <strong>ADMIN</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiGetUsersWithAnyPermissionOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only user names containing the supplied string will be returned + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20018 +*/ + +type PermissionManagementApiGetUsersWithAnyPermissionOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetUsersWithAnyPermission(ctx context.Context, localVarOptionals *PermissionManagementApiGetUsersWithAnyPermissionOpts) (InlineResponse20018, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20018 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/permissions/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20018 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get users with permission to repository +Retrieve a page of users that have been granted at least one permission for the specified repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository or a higher project or global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PermissionManagementApiGetUsersWithAnyPermission2Opts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only user names containing the supplied string will be returned. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20032 +*/ + +type PermissionManagementApiGetUsersWithAnyPermission2Opts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetUsersWithAnyPermission2(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PermissionManagementApiGetUsersWithAnyPermission2Opts) (InlineResponse20032, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20032 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/users" + 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 localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20032 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get users with no global permission +Retrieve a page of users that have no granted global permissions. The authenticated user must have <strong>ADMIN</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiGetUsersWithoutAnyPermissionOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only user names containing the supplied string will be returned + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2005 +*/ + +type PermissionManagementApiGetUsersWithoutAnyPermissionOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetUsersWithoutAnyPermission(ctx context.Context, localVarOptionals *PermissionManagementApiGetUsersWithoutAnyPermissionOpts) (InlineResponse2005, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2005 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/permissions/users/none" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2005 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Get users without repository permission +Retrieve a page of <i>licensed</i> users that have no granted permissions for the specified repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository or a higher project or global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PermissionManagementApiGetUsersWithoutPermission1Opts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only user names containing the supplied string will be returned. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2005 +*/ + +type PermissionManagementApiGetUsersWithoutPermission1Opts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PermissionManagementApiService) GetUsersWithoutPermission1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PermissionManagementApiGetUsersWithoutPermission1Opts) (InlineResponse2005, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2005 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/users/none" + 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 localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2005 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Remove user from group +Remove a user from a group. This is very similar to <code>groups/remove-user</code>, but with the <em>context</em> and <em>itemName</em> attributes of the supplied request entity reversed. On the face of it this may appear redundant, but it facilitates a specific UI component in the application. In the request entity, the <em>context</em> attribute is the user and the <em>itemName</em> is the group. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiRemoveGroupFromUserOpts - Optional Parameters: + * @param "Body" (optional.Interface of GroupPickerContext) - + +*/ + +type PermissionManagementApiRemoveGroupFromUserOpts struct { + Body optional.Interface +} + +func (a *PermissionManagementApiService) RemoveGroupFromUser(ctx context.Context, localVarOptionals *PermissionManagementApiRemoveGroupFromUserOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/remove-group" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Remove user from group +<strong>Deprecated since 2.10</strong>. Use /rest/users/remove-groups instead. Remove a user from a group. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. In the request entity, the <em>context</em> attribute is the group and the <em>itemName</em> is the user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiRemoveUserFromGroupOpts - Optional Parameters: + * @param "Body" (optional.Interface of UserPickerContext) - + +*/ + +type PermissionManagementApiRemoveUserFromGroupOpts struct { + Body optional.Interface +} + +func (a *PermissionManagementApiService) RemoveUserFromGroup(ctx context.Context, localVarOptionals *PermissionManagementApiRemoveUserFromGroupOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/groups/remove-user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Rename user +Rename a user. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiRenameUserOpts - Optional Parameters: + * @param "Body" (optional.Interface of UserRename) - +@return RestDetailedUser +*/ + +type PermissionManagementApiRenameUserOpts struct { + Body optional.Interface +} + +func (a *PermissionManagementApiService) RenameUser(ctx context.Context, localVarOptionals *PermissionManagementApiRenameUserOpts) (RestDetailedUser, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestDetailedUser + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/rename" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestDetailedUser + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Revoke all repository permissions for users and groups +Revoke all permissions for the specified repository for the given groups and users. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified repository or a higher global permission to call this resource. In addition, a user may not revoke a group's permission if their own permission would be revoked as a result, nor may they revoke their own permission unless they have a global permission that already implies that permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PermissionManagementApiRevokePermissions1Opts - Optional Parameters: + * @param "User" (optional.String) - The names of the users + * @param "Group" (optional.String) - The names of the groups + +*/ + +type PermissionManagementApiRevokePermissions1Opts struct { + User optional.String + Group optional.String +} + +func (a *PermissionManagementApiService) RevokePermissions1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PermissionManagementApiRevokePermissions1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions" + 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 localVarOptionals != nil && localVarOptionals.User.IsSet() { + localVarQueryParams.Add("user", parameterToString(localVarOptionals.User.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Group.IsSet() { + localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Revoke all global permissions for group +Revoke all global permissions for a group. The authenticated user must have: - <strong>ADMIN</strong> permission or higher; and - greater or equal permissions than the current permission level of the group (a user may not demote the permission level of a group with higher permissions than them) to call this resource. In addition, a user may not revoke a group's permissions if their own permission level would be reduced as a result. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The name of the group + +*/ +func (a *PermissionManagementApiService) RevokePermissionsForGroup(ctx context.Context, name string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/permissions/groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("name", parameterToString(name, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Revoke group repository permission +Revoke all permissions for the specified repository for a group. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository or a higher project or global permission to call this resource. In addition, a user may not revoke a group's permissions if it will reduce their own permission level. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param name The name of the group. + * @param repositorySlug The repository slug. + +*/ +func (a *PermissionManagementApiService) RevokePermissionsForGroup2(ctx context.Context, projectKey string, name string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/groups" + 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{} + + localVarQueryParams.Add("name", parameterToString(name, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Revoke all global permissions for user +Revoke all global permissions for a user. The authenticated user must have: - <strong>ADMIN</strong> permission or higher; and - greater or equal permissions than the current permission level of the user (a user may not demote the permission level of a user with higher permissions than them) to call this resource. In addition, a user may not demote their own permission level. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The name of the user + +*/ +func (a *PermissionManagementApiService) RevokePermissionsForUser(ctx context.Context, name string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/permissions/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("name", parameterToString(name, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Revoke user repository permission +Revoke all permissions for the specified repository for a user. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository or a higher project or global permission to call this resource. In addition, a user may not revoke their own repository permissions if they do not have a higher project or global permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param name The name of the user. + * @param repositorySlug The repository slug. + +*/ +func (a *PermissionManagementApiService) RevokePermissionsForUser2(ctx context.Context, projectKey string, name string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/users" + 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{} + + localVarQueryParams.Add("name", parameterToString(name, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Search repository permissions +Search direct and implied permissions of users and groups. This endpoint returns a superset of the results returned by the /users and /groups endpoints because it allows filtering by project and global permissions too. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository or a higher project/global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PermissionManagementApiSearchPermissions1Opts - Optional Parameters: + * @param "Permission" (optional.String) - Permissions to filter by. See the [permissions documentation](https://confluence.atlassian.com/display/BitbucketServer/Using+repository+permissions)for a detailed explanation of what each permission entails. This parameter can be specified multiple times to filter by more than one permission, and can contain repository, project, and global permissions. + * @param "FilterText" (optional.String) - Name of the user or group to filter the name of + * @param "Type_" (optional.String) - Type of entity (user or group)Valid entity types are: - USER- GROUP + +*/ + +type PermissionManagementApiSearchPermissions1Opts struct { + Permission optional.String + FilterText optional.String + Type_ optional.String +} + +func (a *PermissionManagementApiService) SearchPermissions1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PermissionManagementApiSearchPermissions1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/search" + 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 localVarOptionals != nil && localVarOptionals.Permission.IsSet() { + localVarQueryParams.Add("permission", parameterToString(localVarOptionals.Permission.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.FilterText.IsSet() { + localVarQueryParams.Add("filterText", parameterToString(localVarOptionals.FilterText.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Update group repository permission +Promote or demote a group's permission level for the specified repository. Available repository permissions are: - REPO_READ - REPO_WRITE - REPO_ADMIN See the <a href=\"https://confluence.atlassian.com/display/BitbucketServer/Using+repository+permissions\">Bitbucket Server documentation</a> for a detailed explanation of what each permission entails. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository or a higher project or global permission to call this resource. In addition, a user may not demote a group's permission level if their own permission level would be reduced as a result. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param name The names of the groups. + * @param permission The permission to grant + * @param repositorySlug The repository slug. + +*/ +func (a *PermissionManagementApiService) SetPermissionForGroup(ctx context.Context, projectKey string, name []string, permission string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/groups" + 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{} + + localVarQueryParams.Add("name", parameterToString(name, "multi")) + localVarQueryParams.Add("permission", parameterToString(permission, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Update global permission for group +Promote or demote a group's global permission level. Available global permissions are: - LICENSED_USER - PROJECT_CREATE - ADMIN - SYS_ADMIN See the <a href=\"https://confluence.atlassian.com/display/BitbucketServer/Global+permissions\">Bitbucket Server documentation</a> for a detailed explanation of what each permission entails. The authenticated user must have: - <strong>ADMIN</strong> permission or higher; and - the permission they are attempting to grant or higher; and - greater or equal permissions than the current permission level of the group (a user may not demote the permission level of a group with higher permissions than them) to call this resource. In addition, a user may not demote a group's permission level if their own permission level would be reduced as a result. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The names of the groups + * @param permission The permission to grant + +*/ +func (a *PermissionManagementApiService) SetPermissionForGroups(ctx context.Context, name []string, permission string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/permissions/groups" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("name", parameterToString(name, "multi")) + localVarQueryParams.Add("permission", parameterToString(permission, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Update user repository permission +Promote or demote a user's permission level for the specified repository. Available repository permissions are: - REPO_READ</li>- REPO_WRITE</li>- REPO_ADMIN</li></ul>See the <a href=\"https://confluence.atlassian.com/display/BitbucketServer/Using+repository+permissions\">Bitbucket Server documentation</a> for a detailed explanation of what each permission entails. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository or a higher project or global permission to call this resource. In addition, a user may not reduce their own permission level unless they have a project or global permission that already implies that permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param name The names of the users. + * @param permission The permission to grant + * @param repositorySlug The repository slug. + +*/ +func (a *PermissionManagementApiService) SetPermissionForUser(ctx context.Context, projectKey string, name []string, permission string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/permissions/users" + 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{} + + localVarQueryParams.Add("name", parameterToString(name, "multi")) + localVarQueryParams.Add("permission", parameterToString(permission, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Update global permission for user +Promote or demote the global permission level of a user. Available global permissions are: - LICENSED_USER - PROJECT_CREATE - ADMIN - SYS_ADMIN See the <a href=\"https://confluence.atlassian.com/display/BitbucketServer/Global+permissions\">Bitbucket Server documentation</a> for a detailed explanation of what each permission entails. The authenticated user must have: - <strong>ADMIN</strong> permission or higher; and - the permission they are attempting to grant; and - greater or equal permissions than the current permission level of the user (a user may not demote the permission level of a user with higher permissions than them) to call this resource. In addition, a user may not demote their own permission level. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The names of the users + * @param permission The permission to grant + +*/ +func (a *PermissionManagementApiService) SetPermissionForUsers(ctx context.Context, name []string, permission string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/permissions/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("name", parameterToString(name, "multi")) + localVarQueryParams.Add("permission", parameterToString(permission, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Update user details +Update a user's details. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiUpdateUserDetailsOpts - Optional Parameters: + * @param "Body" (optional.Interface of UserUpdate) - +@return RestDetailedUser +*/ + +type PermissionManagementApiUpdateUserDetailsOpts struct { + Body optional.Interface +} + +func (a *PermissionManagementApiService) UpdateUserDetails(ctx context.Context, localVarOptionals *PermissionManagementApiUpdateUserDetailsOpts) (RestDetailedUser, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestDetailedUser + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestDetailedUser + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PermissionManagementApiService Set password for user +Update a user's password. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource, and may not update the password of a user with greater permissions than themselves. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *PermissionManagementApiUpdateUserPasswordOpts - Optional Parameters: + * @param "Body" (optional.Interface of AdminPasswordUpdate) - + +*/ + +type PermissionManagementApiUpdateUserPasswordOpts struct { + Body optional.Interface +} + +func (a *PermissionManagementApiService) UpdateUserPassword(ctx context.Context, localVarOptionals *PermissionManagementApiUpdateUserPasswordOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/credentials" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PermissionManagementApiService Check user removal +Validate if a user can be erased. A username is only valid for erasure if it exists as the username of a deleted user. This endpoint will return an appropriate error response if the supplied username is invalid for erasure. This endpoint does <strong>not</strong> perform the actual user erasure, and will not modify the application in any way. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The username of the user to validate erasability for. + +*/ +func (a *PermissionManagementApiService) ValidateErasable(ctx context.Context, name string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/users/erasure" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("name", parameterToString(name, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_project.go b/vendor/github.com/gdasson/bitbucketv1go/api_project.go new file mode 100644 index 000000000..576a55c59 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_project.go @@ -0,0 +1,7228 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" + "os" +) + +// Linger please +var ( + _ context.Context +) + +type ProjectApiService service +/* +ProjectApiService Enforce project restriction +Create a new project settings restriction for the given project. The authenticated user must have **PROJECT_ADMIN** permission for the target project to create a settings restriction. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body The project settings restriction to create + * @param projectKey The project key. +@return RestProjectSettingsRestriction +*/ +func (a *ProjectApiService) Create3(ctx context.Context, body RestProjectSettingsRestrictionRequest, projectKey string) (RestProjectSettingsRestriction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestProjectSettingsRestriction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings-restriction" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestProjectSettingsRestriction + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Create a new project +Create a new project. To include a custom avatar for the project, the project definition should contain an additional attribute with the key <code>avatar</code> and the value a data URI containing Base64-encoded image data. The URI should be in the following format: <pre> data:(content type, e.g. image/png);base64,(data) </pre>If the data is not Base64-encoded, or if a character set is defined in the URI, or the URI is otherwise invalid, <em>project creation will fail</em>. The authenticated user must have <strong>PROJECT_CREATE</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ProjectApiCreateProjectOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestProject) - The project. +@return RestProject +*/ + +type ProjectApiCreateProjectOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) CreateProject(ctx context.Context, localVarOptionals *ProjectApiCreateProjectOpts) (RestProject, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestProject + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestProject + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Create repository +Create a new repository. Requires an existing project in which this repository will be created. The only parameters which will be used are name and scmId. The authenticated user must have <strong>REPO_CREATE</strong> permission or higher, for the context project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiCreateRepositoryOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestRepository) - The repository +@return RestRepository +*/ + +type ProjectApiCreateRepositoryOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) CreateRepository(ctx context.Context, projectKey string, localVarOptionals *ProjectApiCreateRepositoryOpts) (RestRepository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestRepository + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Create multiple ref restrictions +Allows creating multiple restrictions at once. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiCreateRestrictionsOpts - Optional Parameters: + * @param "Body" (optional.Interface of []RestRestrictionRequest) - The request containing a list of the details of the restrictions to create. +@return RestRefRestriction +*/ + +type ProjectApiCreateRestrictionsOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) CreateRestrictions(ctx context.Context, projectKey string, localVarOptionals *ProjectApiCreateRestrictionsOpts) (RestRefRestriction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRefRestriction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-permissions/latest/projects/{projectKey}/restrictions" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/vnd.atl.bitbucket.bulk+json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRefRestriction + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Create webhook +Create a webhook for the project specified via the URL. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiCreateWebhookOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestWebhook) - The webhook to be created for this project. +@return RestWebhook +*/ + +type ProjectApiCreateWebhookOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) CreateWebhook(ctx context.Context, projectKey string, localVarOptionals *ProjectApiCreateWebhookOpts) (RestWebhook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestWebhook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/webhooks" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestWebhook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Stop enforcing project restriction +Delete a specified project settings restriction. If a restriction does not exist for the specified project, namespace, featureKey, and componentKey, the request will be ignored and a 204 response will be returned. The authenticated user must have **PROJECT_ADMIN** permission for the target project to delete a settings restriction. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param namespace A namespace used to identify the provider of the feature + * @param featureKey A key to uniquely identify the feature within the provided namespace + * @param optional nil or *ProjectApiDelete7Opts - Optional Parameters: + * @param "ComponentKey" (optional.String) - A key to uniquely identify individually restrictable subcomponents of a feature within the provided feature key and namespace + +*/ + +type ProjectApiDelete7Opts struct { + ComponentKey optional.String +} + +func (a *ProjectApiService) Delete7(ctx context.Context, projectKey string, namespace string, featureKey string, localVarOptionals *ProjectApiDelete7Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings-restriction" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("namespace", parameterToString(namespace, "")) + if localVarOptionals != nil && localVarOptionals.ComponentKey.IsSet() { + localVarQueryParams.Add("componentKey", parameterToString(localVarOptionals.ComponentKey.Value(), "")) + } + localVarQueryParams.Add("featureKey", parameterToString(featureKey, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Delete auto decline settings +Delete auto decline settings for the supplied project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for this project to call the resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + +*/ +func (a *ProjectApiService) DeleteAutoDeclineSettings(ctx context.Context, projectKey string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/auto-decline" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Delete project +Delete the project matching the supplied <strong>projectKey</strong>. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + +*/ +func (a *ProjectApiService) DeleteProject(ctx context.Context, projectKey string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Delete repository +Schedule the repository matching the supplied <strong>projectKey</strong> and <strong>repositorySlug</strong> to be deleted. The authenticated user must have sufficient permissions specified by the repository delete policy to call this resource. The default permission required is <strong>REPO_ADMIN</strong> permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + +*/ +func (a *ProjectApiService) DeleteRepository(ctx context.Context, projectKey string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 204 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Delete a ref restriction +Deletes a restriction as specified by a restriction id. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission or higher to call this resource. Only authenticated users may call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The restriction id. + +*/ +func (a *ProjectApiService) DeleteRestriction(ctx context.Context, projectKey string, id string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-permissions/latest/projects/{projectKey}/restrictions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Delete webhook +Delete a webhook for the project specified via the URL. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param webhookId The ID of the webhook to be deleted. + +*/ +func (a *ProjectApiService) DeleteWebhook(ctx context.Context, projectKey string, webhookId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/webhooks/{webhookId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"webhookId"+"}", fmt.Sprintf("%v", webhookId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Disable repository hook +Disable a repository hook for this project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The hook key. +@return RestRepositoryHook +*/ +func (a *ProjectApiService) DisableHook(ctx context.Context, projectKey string, hookKey string) (RestRepositoryHook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryHook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/enabled" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryHook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Enable repository hook +Enable a repository hook for this project and optionally apply new configuration. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. A JSON document may be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The hook key. + * @param optional nil or *ProjectApiEnableHookOpts - Optional Parameters: + * @param "ContentLength" (optional.Int64) - The content length. +@return RestRepositoryHook +*/ + +type ProjectApiEnableHookOpts struct { + ContentLength optional.Int64 +} + +func (a *ProjectApiService) EnableHook(ctx context.Context, projectKey string, hookKey string, localVarOptionals *ProjectApiEnableHookOpts) (RestRepositoryHook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryHook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/enabled" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.ContentLength.IsSet() { + localVarHeaderParams["Content-Length"] = parameterToString(localVarOptionals.ContentLength.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryHook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Find webhooks +Find webhooks in this project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiFindWebhooksOpts - Optional Parameters: + * @param "Event" (optional.String) - List of <code>com.atlassian.webhooks.WebhookEvent</code> IDs to filter for + * @param "Statistics" (optional.Bool) - <code>true</code> if statistics should be provided for all found webhooks + +*/ + +type ProjectApiFindWebhooksOpts struct { + Event optional.String + Statistics optional.Bool +} + +func (a *ProjectApiService) FindWebhooks(ctx context.Context, projectKey string, localVarOptionals *ProjectApiFindWebhooksOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/webhooks" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Event.IsSet() { + localVarQueryParams.Add("event", parameterToString(localVarOptionals.Event.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Statistics.IsSet() { + localVarQueryParams.Add("statistics", parameterToString(localVarOptionals.Statistics.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Fork repository +Create a new repository forked from an existing repository. The JSON body for this <code>POST</code> is not required to contain <i>any</i> properties. Even the name may be omitted. The following properties will be used, if provided: - <code>\"name\":\"Fork name\"</code> - Specifies the forked repository's name - Defaults to the name of the origin repository if not specified - <code>\"defaultBranch\":\"main\"</code> - Specifies the forked repository's default branch - Defaults to the origin repository's default branch if not specified - <code>\"project\":{\"key\":\"TARGET_KEY\"}</code> - Specifies the forked repository's target project by key - Defaults to the current user's personal project if not specified The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository and <strong>PROJECT_ADMIN</strong> on the target project to call this resource. Note that users <i>always</i> have <b>PROJECT_ADMIN</b> permission on their personal projects. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *ProjectApiForkRepositoryOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestRepository) - The rest fork. +@return RestRepository +*/ + +type ProjectApiForkRepositoryOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) ForkRepository(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *ProjectApiForkRepositoryOpts) (RestRepository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestRepository + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get enforcing project setting +Get a specified project settings restriction for the given namespace, feature key and component key. Note that not providing the component key will **not** return restrictions for the namespace and feature key with a component key set. The authenticated user must have **PROJECT_VIEW** permission for the target project to retrieve a settings restriction. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param namespace The namespace used to identify the provider of the feature + * @param featureKey The feature key to uniquely identify the feature within the provided namespace + * @param optional nil or *ProjectApiGet5Opts - Optional Parameters: + * @param "ComponentKey" (optional.String) - The component key to uniquely identify individually restrictable subcomponents of a feature within the provided feature key and namespace +@return RestProjectSettingsRestriction +*/ + +type ProjectApiGet5Opts struct { + ComponentKey optional.String +} + +func (a *ProjectApiService) Get5(ctx context.Context, projectKey string, namespace string, featureKey string, localVarOptionals *ProjectApiGet5Opts) (RestProjectSettingsRestriction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestProjectSettingsRestriction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings-restriction" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("namespace", parameterToString(namespace, "")) + if localVarOptionals != nil && localVarOptionals.ComponentKey.IsSet() { + localVarQueryParams.Add("componentKey", parameterToString(localVarOptionals.ComponentKey.Value(), "")) + } + localVarQueryParams.Add("featureKey", parameterToString(featureKey, "")) + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestProjectSettingsRestriction + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get all enforcing project settings +Get all project settings restrictions for the given namespace and feature key, including those with a component key set. The authenticated user must have **PROJECT_VIEW** permission for the target project to retrieve a settings restrictions. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param namespace A namespace used to identify the provider of the feature + * @param featureKey A key to uniquely identify the feature within the provided namespace + * @param optional nil or *ProjectApiGetAllOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20047 +*/ + +type ProjectApiGetAllOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetAll(ctx context.Context, projectKey string, namespace string, featureKey string, localVarOptionals *ProjectApiGetAllOpts) (InlineResponse20047, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20047 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings-restriction/all" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("namespace", parameterToString(namespace, "")) + localVarQueryParams.Add("featureKey", parameterToString(featureKey, "")) + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20047 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get auto decline settings +Retrieves the auto decline settings for the supplied project. Default settings are returned if no explicit settings have been set for the project. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key +@return RestAutoDeclineSettings +*/ +func (a *ProjectApiService) GetAutoDeclineSettings(ctx context.Context, projectKey string) (RestAutoDeclineSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAutoDeclineSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/auto-decline" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAutoDeclineSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get project avatar +Retrieve the avatar for the project matching the supplied <strong>moduleKey</strong>. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param hookKey The complete module key of the hook module. + * @param optional nil or *ProjectApiGetAvatarOpts - Optional Parameters: + * @param "Version" (optional.String) - (optional) Version used for HTTP caching only - any non-blank version will result in a large max-age Cache-Control header. Note that this does not affect the Last-Modified header. + +*/ + +type ProjectApiGetAvatarOpts struct { + Version optional.String +} + +func (a *ProjectApiService) GetAvatar(ctx context.Context, hookKey string, localVarOptionals *ProjectApiGetAvatarOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/hooks/{hookKey}/avatar" + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Version.IsSet() { + localVarQueryParams.Add("version", parameterToString(localVarOptionals.Version.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Get configured hook scripts +Return a page of hook scripts configured for the specified project. This endpoint requires **PROJECT_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiGetConfigurationsOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20031 +*/ + +type ProjectApiGetConfigurationsOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetConfigurations(ctx context.Context, projectKey string, localVarOptionals *ProjectApiGetConfigurationsOpts) (InlineResponse20031, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20031 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/hook-scripts" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20031 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get repository default branch +Retrieves the repository's <i>configured</i> default branch. Every repository has a <i>configured</i> default branch, but that branch may not actually <i>exist</i> in the repository. For example, a newly-created repository will have a configured default branch even though no branches have been pushed yet. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return RestMinimalRef +*/ +func (a *ProjectApiService) GetDefaultBranch2(ctx context.Context, projectKey string, repositorySlug string) (RestMinimalRef, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMinimalRef + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/default-branch" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMinimalRef + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get repository forks +Retrieve repositories which have been forked from this one. Unlike #getRelatedRepositories(Repository, PageRequest) related repositories, this only looks at a given repository's direct forks. If those forks have themselves been the origin of more forks, such \"grandchildren\" repositories will not be retrieved. Only repositories to which the authenticated user has <b>REPO_READ</b> permission will be included, even if other repositories have been forked from this one. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *ProjectApiGetForkedRepositoriesOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20029 +*/ + +type ProjectApiGetForkedRepositoriesOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetForkedRepositories(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *ProjectApiGetForkedRepositoriesOpts) (InlineResponse20029, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20029 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/forks" + 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 localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20029 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get groups with permission to project +Retrieve a page of groups that have been granted at least one permission for the specified project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiGetGroupsWithAnyPermission1Opts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only group names containing the supplied string will be returned + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20018 +*/ + +type ProjectApiGetGroupsWithAnyPermission1Opts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetGroupsWithAnyPermission1(ctx context.Context, projectKey string, localVarOptionals *ProjectApiGetGroupsWithAnyPermission1Opts) (InlineResponse20018, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20018 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20018 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get groups without project permission +Retrieve a page of groups that have no granted permissions for the specified project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiGetGroupsWithoutAnyPermission1Opts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only group names containing the supplied string will be returned + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20016 +*/ + +type ProjectApiGetGroupsWithoutAnyPermission1Opts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetGroupsWithoutAnyPermission1(ctx context.Context, projectKey string, localVarOptionals *ProjectApiGetGroupsWithoutAnyPermission1Opts) (InlineResponse20016, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20016 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/groups/none" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 202 { + var v InlineResponse20016 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get last webhook invocation details +Get the latest invocations for a specific webhook. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param webhookId ID of the webhook + * @param optional nil or *ProjectApiGetLatestInvocationOpts - Optional Parameters: + * @param "Event" (optional.String) - The string ID of a specific event to retrieve the last invocation for. + * @param "Outcome" (optional.String) - The outcome to filter for. Can be SUCCESS, FAILURE, ERROR. None specified means that the all will be considered +@return RestDetailedInvocation +*/ + +type ProjectApiGetLatestInvocationOpts struct { + Event optional.String + Outcome optional.String +} + +func (a *ProjectApiService) GetLatestInvocation(ctx context.Context, projectKey string, webhookId string, localVarOptionals *ProjectApiGetLatestInvocationOpts) (RestDetailedInvocation, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestDetailedInvocation + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/webhooks/{webhookId}/latest" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"webhookId"+"}", fmt.Sprintf("%v", webhookId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Event.IsSet() { + localVarQueryParams.Add("event", parameterToString(localVarOptionals.Event.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Outcome.IsSet() { + localVarQueryParams.Add("outcome", parameterToString(localVarOptionals.Outcome.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestDetailedInvocation + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get a project +Retrieve the project matching the supplied <strong>projectKey</strong>. The authenticated user must have <strong>PROJECT_VIEW</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. +@return RestProject +*/ +func (a *ProjectApiService) GetProject(ctx context.Context, projectKey string) (RestProject, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestProject + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestProject + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get avatar for project +Retrieve the avatar for the project matching the supplied <strong>projectKey</strong>. The authenticated user must have <strong>PROJECT_VIEW</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiGetProjectAvatarOpts - Optional Parameters: + * @param "S" (optional.String) - The desired size of the image. The server will return an image as close as possible to the specified size. + +*/ + +type ProjectApiGetProjectAvatarOpts struct { + S optional.String +} + +func (a *ProjectApiService) GetProjectAvatar(ctx context.Context, projectKey string, localVarOptionals *ProjectApiGetProjectAvatarOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/avatar.png" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.S.IsSet() { + localVarQueryParams.Add("s", parameterToString(localVarOptionals.S.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Get projects +Retrieve a page of projects. Only projects for which the authenticated user has the <strong>PROJECT_VIEW</strong> permission will be returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *ProjectApiGetProjectsOpts - Optional Parameters: + * @param "Name" (optional.String) - Name to filter by. + * @param "Permission" (optional.String) - Permission to filter by + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20030 +*/ + +type ProjectApiGetProjectsOpts struct { + Name optional.String + Permission optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetProjects(ctx context.Context, localVarOptionals *ProjectApiGetProjectsOpts) (InlineResponse20030, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20030 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Name.IsSet() { + localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Permission.IsSet() { + localVarQueryParams.Add("permission", parameterToString(localVarOptionals.Permission.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20030 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get merge strategy +Retrieve the merge strategy configuration for this project and SCM. The authenticated user must have <strong>PROJECT_READ</strong> permission for the context repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param scmId The SCM to get strategies for. +@return RestPullRequestSettings +*/ +func (a *ProjectApiService) GetPullRequestSettings(ctx context.Context, projectKey string, scmId string) (RestPullRequestSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/pull-requests/{scmId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"scmId"+"}", fmt.Sprintf("%v", scmId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get related repository +Retrieve repositories which are related to this one. Related repositories are from the same Repository#getHierarchyId() hierarchy as this repository. Only repositories to which the authenticated user has <b>REPO_READ</b> permission will be included, even if more repositories are part of this repository's hierarchy. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *ProjectApiGetRelatedRepositoriesOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20029 +*/ + +type ProjectApiGetRelatedRepositoriesOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetRelatedRepositories(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *ProjectApiGetRelatedRepositoriesOpts) (InlineResponse20029, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20029 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/related" + 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 localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20029 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get repositories for project +Retrieve repositories from the project corresponding to the supplied <strong>projectKey</strong>. The authenticated user must have <strong>PROJECT_READ</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiGetRepositoriesOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20029 +*/ + +type ProjectApiGetRepositoriesOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetRepositories(ctx context.Context, projectKey string, localVarOptionals *ProjectApiGetRepositoriesOpts) (InlineResponse20029, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20029 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20029 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get repository +Retrieve the repository matching the supplied <strong>projectKey</strong> and <strong>repositorySlug</strong>. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return RestRepository +*/ +func (a *ProjectApiService) GetRepository(ctx context.Context, projectKey string, repositorySlug string) (RestRepository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepository + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get a repository hook +Retrieve a repository hook for this project. The authenticated user must have <strong>PROJECT_READ</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The hook key. +@return RestRepositoryHook +*/ +func (a *ProjectApiService) GetRepositoryHook(ctx context.Context, projectKey string, hookKey string) (RestRepositoryHook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryHook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/hooks/{hookKey}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryHook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get repository hooks +Retrieve a page of repository hooks for this project. The authenticated user must have <strong>PROJECT_READ</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiGetRepositoryHooksOpts - Optional Parameters: + * @param "Type_" (optional.String) - The optional type to filter by. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20044 +*/ + +type ProjectApiGetRepositoryHooksOpts struct { + Type_ optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetRepositoryHooks(ctx context.Context, projectKey string, localVarOptionals *ProjectApiGetRepositoryHooksOpts) (InlineResponse20044, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20044 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20044 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get a ref restriction +Returns a restriction as specified by a restriction id. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission or higher to call this resource. Only authenticated users may call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The restriction id. +@return RestRefRestriction +*/ +func (a *ProjectApiService) GetRestriction(ctx context.Context, projectKey string, id string) (RestRefRestriction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRefRestriction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-permissions/latest/projects/{projectKey}/restrictions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRefRestriction + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Search for ref restrictions +Search for restrictions using the supplied parameters. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission or higher to call this resource. Only authenticated users may call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiGetRestrictionsOpts - Optional Parameters: + * @param "MatcherType" (optional.String) - Matcher type to filter on + * @param "MatcherId" (optional.String) - Matcher id to filter on. Requires the matcherType parameter to be specified also. + * @param "Type_" (optional.String) - Types of restrictions to filter on. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20013 +*/ + +type ProjectApiGetRestrictionsOpts struct { + MatcherType optional.String + MatcherId optional.String + Type_ optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetRestrictions(ctx context.Context, projectKey string, localVarOptionals *ProjectApiGetRestrictionsOpts) (InlineResponse20013, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20013 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-permissions/latest/projects/{projectKey}/restrictions" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.MatcherType.IsSet() { + localVarQueryParams.Add("matcherType", parameterToString(localVarOptionals.MatcherType.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MatcherId.IsSet() { + localVarQueryParams.Add("matcherId", parameterToString(localVarOptionals.MatcherId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20013 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get repository hook settings +Retrieve the settings for a repository hook for this project. The authenticated user must have <strong>PROJECT_READ</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The hook key. +@return ExampleSettings +*/ +func (a *ProjectApiService) GetSettings(ctx context.Context, projectKey string, hookKey string) (ExampleSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExampleSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/settings" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ExampleSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get users with permission to project +Retrieve a page of users that have been granted at least one permission for the specified project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiGetUsersWithAnyPermission1Opts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only user names containing the supplied string will be returned + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20032 +*/ + +type ProjectApiGetUsersWithAnyPermission1Opts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetUsersWithAnyPermission1(ctx context.Context, projectKey string, localVarOptionals *ProjectApiGetUsersWithAnyPermission1Opts) (InlineResponse20032, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20032 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/users" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20032 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get users without project permission +Retrieve a page of <i>licensed</i> users that have no granted permissions for the specified project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiGetUsersWithoutPermissionOpts - Optional Parameters: + * @param "Filter" (optional.String) - If specified only user names containing the supplied string will be returned + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2005 +*/ + +type ProjectApiGetUsersWithoutPermissionOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *ProjectApiService) GetUsersWithoutPermission(ctx context.Context, projectKey string, localVarOptionals *ProjectApiGetUsersWithoutPermissionOpts) (InlineResponse2005, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2005 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/users/none" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2005 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get webhook +Get a webhook by ID. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param webhookId ID of the webhook + * @param optional nil or *ProjectApiGetWebhookOpts - Optional Parameters: + * @param "Statistics" (optional.String) - <code>true</code> if statistics should be provided for the webhook +@return RestWebhook +*/ + +type ProjectApiGetWebhookOpts struct { + Statistics optional.String +} + +func (a *ProjectApiService) GetWebhook(ctx context.Context, projectKey string, webhookId string, localVarOptionals *ProjectApiGetWebhookOpts) (RestWebhook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestWebhook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/webhooks/{webhookId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"webhookId"+"}", fmt.Sprintf("%v", webhookId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Statistics.IsSet() { + localVarQueryParams.Add("statistics", parameterToString(localVarOptionals.Statistics.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestWebhook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Check default project permission +Check whether the specified permission is the default permission (granted to all users) for a project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param permission The permission to grant. Available project permissions are: - PROJECT_READ - PROJECT_WRITE - PROJECT_ADMIN +@return RestPermitted +*/ +func (a *ProjectApiService) HasAllUserPermission(ctx context.Context, projectKey string, permission string) (RestPermitted, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPermitted + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/{permission}/all" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"permission"+"}", fmt.Sprintf("%v", permission), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPermitted + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Grant project permission +Grant or revoke a project permission to all users, i.e. set the default permission. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param permission The permission to grant. Available project permissions are: - PROJECT_READ - PROJECT_WRITE - PROJECT_ADMIN + * @param optional nil or *ProjectApiModifyAllUserPermissionOpts - Optional Parameters: + * @param "Allow" (optional.String) - <em>true</em> to grant the specified permission to all users, or <em>false</em> to revoke it + +*/ + +type ProjectApiModifyAllUserPermissionOpts struct { + Allow optional.String +} + +func (a *ProjectApiService) ModifyAllUserPermission(ctx context.Context, projectKey string, permission string, localVarOptionals *ProjectApiModifyAllUserPermissionOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/{permission}/all" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"permission"+"}", fmt.Sprintf("%v", permission), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Allow.IsSet() { + localVarQueryParams.Add("allow", parameterToString(localVarOptionals.Allow.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Remove a hook script +Removes the hook script from the set of hook scripts configured to run in all repositories under the project. This endpoint requires **PROJECT_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param scriptId The ID of the hook script + +*/ +func (a *ProjectApiService) RemoveConfiguration(ctx context.Context, projectKey string, scriptId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/hook-scripts/{scriptId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"scriptId"+"}", fmt.Sprintf("%v", scriptId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Retry repository creation +If a create or fork operation fails, calling this method will clean up the broken repository and try again. The repository must be in an INITIALISATION_FAILED state. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return RestRepository +*/ +func (a *ProjectApiService) RetryCreateRepository(ctx context.Context, projectKey string, repositorySlug string) (RestRepository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/recreate" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepository + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Revoke project permissions +Revoke all permissions for the specified project for the given groups and users. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. In addition, a user may not revoke a group's permission if their own permission would be revoked as a result, nor may they revoke their own permission unless they have a global permission that already implies that permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiRevokePermissionsOpts - Optional Parameters: + * @param "User" (optional.String) - The names of the users + * @param "Group" (optional.String) - The names of the groups + +*/ + +type ProjectApiRevokePermissionsOpts struct { + User optional.String + Group optional.String +} + +func (a *ProjectApiService) RevokePermissions(ctx context.Context, projectKey string, localVarOptionals *ProjectApiRevokePermissionsOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.User.IsSet() { + localVarQueryParams.Add("user", parameterToString(localVarOptionals.User.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Group.IsSet() { + localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Revoke group project permission + Revoke all permissions for the specified project for a group. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. In addition, a user may not revoke a group's permissions if it will reduce their own permission level. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiRevokePermissionsForGroup1Opts - Optional Parameters: + * @param "Name" (optional.String) - The name of the group + +*/ + +type ProjectApiRevokePermissionsForGroup1Opts struct { + Name optional.String +} + +func (a *ProjectApiService) RevokePermissionsForGroup1(ctx context.Context, projectKey string, localVarOptionals *ProjectApiRevokePermissionsForGroup1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Name.IsSet() { + localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Revoke user project permission +Revoke all permissions for the specified project for a user. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. In addition, a user may not revoke their own project permissions if they do not have a higher global permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiRevokePermissionsForUser1Opts - Optional Parameters: + * @param "Name" (optional.String) - The name of the user + +*/ + +type ProjectApiRevokePermissionsForUser1Opts struct { + Name optional.String +} + +func (a *ProjectApiService) RevokePermissionsForUser1(ctx context.Context, projectKey string, localVarOptionals *ProjectApiRevokePermissionsForUser1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/users" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Name.IsSet() { + localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Search project permissions +Search direct and implied permissions of principals (users and groups). This endpoint returns a superset of the results returned by the /users and /groups endpoints because it allows filtering by global permissions too. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiSearchPermissionsOpts - Optional Parameters: + * @param "Permission" (optional.String) - Permissions to filter by. See the [permissions documentation](https://confluence.atlassian.com/display/BitbucketServer/Using+project+permissions)for a detailed explanation of what each permission entails. This parameter can be specified multiple times to filter by more than one permission, and can contain global and project permissions. + * @param "FilterText" (optional.String) - Name of the user or group to filter the name of + * @param "Type_" (optional.String) - Type of entity (user or group)Valid entity types are: - USER- GROUP + +*/ + +type ProjectApiSearchPermissionsOpts struct { + Permission optional.String + FilterText optional.String + Type_ optional.String +} + +func (a *ProjectApiService) SearchPermissions(ctx context.Context, projectKey string, localVarOptionals *ProjectApiSearchPermissionsOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/search" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Permission.IsSet() { + localVarQueryParams.Add("permission", parameterToString(localVarOptionals.Permission.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.FilterText.IsSet() { + localVarQueryParams.Add("filterText", parameterToString(localVarOptionals.FilterText.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Create/Update auto decline settings +Creates or updates the auto decline settings for the supplied project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for this project to call the resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiSetAutoDeclineSettingsOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestAutoDeclineSettingsRequest) - The settings to create or update +@return RestAutoDeclineSettings +*/ + +type ProjectApiSetAutoDeclineSettingsOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) SetAutoDeclineSettings(ctx context.Context, projectKey string, localVarOptionals *ProjectApiSetAutoDeclineSettingsOpts) (RestAutoDeclineSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAutoDeclineSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/auto-decline" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAutoDeclineSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Create/update a hook script +Creates/updates the hook script configuration for the provided hook script and project. This endpoint requires **PROJECT_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param scriptId The ID of the hook script + * @param optional nil or *ProjectApiSetConfigurationOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestHookScriptTriggers) - The hook triggers for which the hook script should be run +@return RestHookScriptConfig +*/ + +type ProjectApiSetConfigurationOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) SetConfiguration(ctx context.Context, projectKey string, scriptId string, localVarOptionals *ProjectApiSetConfigurationOpts) (RestHookScriptConfig, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestHookScriptConfig + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/hook-scripts/{scriptId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"scriptId"+"}", fmt.Sprintf("%v", scriptId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestHookScriptConfig + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Update default branch for repository +Update the default branch of a repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *ProjectApiSetDefaultBranch2Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestBranch) - The branch to set as default + +*/ + +type ProjectApiSetDefaultBranch2Opts struct { + Body optional.Interface +} + +func (a *ProjectApiService) SetDefaultBranch2(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *ProjectApiSetDefaultBranch2Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/default-branch" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Update group project permission +Promote or demote a group's permission level for the specified project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. In addition, a user may not demote a group's permission level if theirown permission level would be reduced as a result. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiSetPermissionForGroups1Opts - Optional Parameters: + * @param "Name" (optional.String) - The names of the groups + * @param "Permission" (optional.String) - The permission to grant.See the [permissions documentation](https://confluence.atlassian.com/display/BitbucketServer/Using+project+permissions)for a detailed explanation of what each permission entails. Available project permissions are: - PROJECT_READ - PROJECT_WRITE - PROJECT_ADMIN + +*/ + +type ProjectApiSetPermissionForGroups1Opts struct { + Name optional.String + Permission optional.String +} + +func (a *ProjectApiService) SetPermissionForGroups1(ctx context.Context, projectKey string, localVarOptionals *ProjectApiSetPermissionForGroups1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Name.IsSet() { + localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Permission.IsSet() { + localVarQueryParams.Add("permission", parameterToString(localVarOptionals.Permission.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Update user project permission +Promote or demote a user's permission level for the specified project. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project or a higher global permission to call this resource. In addition, a user may not reduce their own permission level unless they have a global permission that already implies that permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param optional nil or *ProjectApiSetPermissionForUsers1Opts - Optional Parameters: + * @param "Name" (optional.String) - The names of the users + * @param "Permission" (optional.String) - The permission to grant.See the [permissions documentation](https://confluence.atlassian.com/display/BitbucketServer/Using+project+permissions)for a detailed explanation of what each permission entails. Available project permissions are: - PROJECT_READ - PROJECT_WRITE - PROJECT_ADMIN + +*/ + +type ProjectApiSetPermissionForUsers1Opts struct { + Name optional.String + Permission optional.String +} + +func (a *ProjectApiService) SetPermissionForUsers1(ctx context.Context, projectKey string, localVarOptionals *ProjectApiSetPermissionForUsers1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/permissions/users" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Name.IsSet() { + localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Permission.IsSet() { + localVarQueryParams.Add("permission", parameterToString(localVarOptionals.Permission.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Update repository hook settings +Modify the settings for a repository hook for this project. The service will reject any settings which are too large, the current limit is 32KB once serialized. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. A JSON document can be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The complete module key of the hook module. + * @param optional nil or *ProjectApiSetSettingsOpts - Optional Parameters: + * @param "Body" (optional.Interface of ExampleSettings) - The raw settings. +@return ExampleSettings +*/ + +type ProjectApiSetSettingsOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) SetSettings(ctx context.Context, projectKey string, hookKey string, localVarOptionals *ProjectApiSetSettingsOpts) (ExampleSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExampleSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/hooks/{hookKey}/settings" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ExampleSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Get repository contributing guidelines +Retrieves the contributing guidelines for the repository, if they've been defined. This checks the repository for a CONTRIBUTING file, optionally with an md or txt extension, and, if found, streams it. By default, the <i>raw content</i> of the file is streamed. Appending <code>?markup</code> to the URL will stream an HTML-rendered version instead. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *ProjectApiStreamContributingOpts - Optional Parameters: + * @param "At" (optional.String) - A specific commit or ref to retrieve the guidelines at, or the default branch if not specified + * @param "Markup" (optional.String) - If present or <code>\"true\"</code>, triggers the raw content to be markup-rendered and returned as HTML; otherwise, if not specified, or any value other than <code>\"true\"</code>, the content is streamed without markup + * @param "HtmlEscape" (optional.String) - (Optional) true if HTML should be escaped in the input markup, false otherwise. If not specified, the value of the <code>markup.render.html.escape</code> property, which is <code>true</code> by default, will be used + * @param "IncludeHeadingId" (optional.String) - (Optional) true if headings should contain an ID based on the heading content. If not specified, the value of the <code>markup.render.headerids</code> property, which is false by default, will be used + * @param "Hardwrap" (optional.String) - (Optional) Whether the markup implementation should convert newlines to breaks. If not specified, the value of the <code>markup.render.hardwrap</code> property, which is <code>true</code> by default, will be used + +*/ + +type ProjectApiStreamContributingOpts struct { + At optional.String + Markup optional.String + HtmlEscape optional.String + IncludeHeadingId optional.String + Hardwrap optional.String +} + +func (a *ProjectApiService) StreamContributing(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *ProjectApiStreamContributingOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/contributing" + 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 localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Markup.IsSet() { + localVarQueryParams.Add("markup", parameterToString(localVarOptionals.Markup.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.HtmlEscape.IsSet() { + localVarQueryParams.Add("htmlEscape", parameterToString(localVarOptionals.HtmlEscape.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludeHeadingId.IsSet() { + localVarQueryParams.Add("includeHeadingId", parameterToString(localVarOptionals.IncludeHeadingId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Hardwrap.IsSet() { + localVarQueryParams.Add("hardwrap", parameterToString(localVarOptionals.Hardwrap.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Get repository license +Retrieves the license for the repository, if it's been defined. This checks the repository for a <pre>LICENSE</pre> file, optionally with an <pre>md</pre> or <pre>txt</pre>extension, and, if found, streams it. By default, the <i>raw content</i> of the file is streamed. Appending <pre>?markup</pre> to the URL will stream an HTML-rendered version instead. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *ProjectApiStreamLicenseOpts - Optional Parameters: + * @param "At" (optional.String) - A specific commit or ref to retrieve the guidelines at, or the default branch if not specified + * @param "Markup" (optional.String) - If present or <code>\"true\"</code>, triggers the raw content to be markup-rendered and returned as HTML; otherwise, if not specified, or any value other than <code>\"true\"</code>, the content is streamed without markup + * @param "HtmlEscape" (optional.String) - (Optional) true if HTML should be escaped in the input markup, false otherwise. If not specified, the value of the <code>markup.render.html.escape</code> property, which is <code>true</code> by default, will be used + * @param "IncludeHeadingId" (optional.String) - (Optional) true if headings should contain an ID based on the heading content. If not specified, the value of the <code>markup.render.headerids</code> property, which is false by default, will be used + * @param "Hardwrap" (optional.String) - (Optional) Whether the markup implementation should convert newlines to breaks. If not specified, the value of the <code>markup.render.hardwrap</code> property, which is <code>true</code> by default, will be used + +*/ + +type ProjectApiStreamLicenseOpts struct { + At optional.String + Markup optional.String + HtmlEscape optional.String + IncludeHeadingId optional.String + Hardwrap optional.String +} + +func (a *ProjectApiService) StreamLicense(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *ProjectApiStreamLicenseOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/license" + 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 localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Markup.IsSet() { + localVarQueryParams.Add("markup", parameterToString(localVarOptionals.Markup.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.HtmlEscape.IsSet() { + localVarQueryParams.Add("htmlEscape", parameterToString(localVarOptionals.HtmlEscape.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludeHeadingId.IsSet() { + localVarQueryParams.Add("includeHeadingId", parameterToString(localVarOptionals.IncludeHeadingId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Hardwrap.IsSet() { + localVarQueryParams.Add("hardwrap", parameterToString(localVarOptionals.Hardwrap.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Get repository readme +Retrieves the README for the repository, if it's been defined. This checks the repository for a <pre>README</pre> file, optionally with an <pre>md</pre> or <pre>txt</pre>extension, and, if found, streams it. By default, the <i>raw content</i> of the file is streamed. Appending <pre>?markup</pre> to the URL will stream an HTML-rendered version instead. Note that, when streaming HTML, relative URLs in the README will not work if applied relative to this URL. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *ProjectApiStreamReadmeOpts - Optional Parameters: + * @param "At" (optional.String) - A specific commit or ref to retrieve the guidelines at, or the default branch if not specified + * @param "Markup" (optional.String) - If present or <code>\"true\"</code>, triggers the raw content to be markup-rendered and returned as HTML; otherwise, if not specified, or any value other than <code>\"true\"</code>, the content is streamed without markup + * @param "HtmlEscape" (optional.String) - (Optional) true if HTML should be escaped in the input markup, false otherwise. If not specified, the value of the <code>markup.render.html.escape</code> property, which is <code>true</code> by default, will be used + * @param "IncludeHeadingId" (optional.String) - (Optional) true if headings should contain an ID based on the heading content. If not specified, the value of the <code>markup.render.headerids</code> property, which is false by default, will be used + * @param "Hardwrap" (optional.String) - (Optional) Whether the markup implementation should convert newlines to breaks. If not specified, the value of the <code>markup.render.hardwrap</code> property, which is <code>true</code> by default, will be used + +*/ + +type ProjectApiStreamReadmeOpts struct { + At optional.String + Markup optional.String + HtmlEscape optional.String + IncludeHeadingId optional.String + Hardwrap optional.String +} + +func (a *ProjectApiService) StreamReadme(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *ProjectApiStreamReadmeOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/readme" + 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 localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Markup.IsSet() { + localVarQueryParams.Add("markup", parameterToString(localVarOptionals.Markup.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.HtmlEscape.IsSet() { + localVarQueryParams.Add("htmlEscape", parameterToString(localVarOptionals.HtmlEscape.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludeHeadingId.IsSet() { + localVarQueryParams.Add("includeHeadingId", parameterToString(localVarOptionals.IncludeHeadingId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Hardwrap.IsSet() { + localVarQueryParams.Add("hardwrap", parameterToString(localVarOptionals.Hardwrap.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +ProjectApiService Update project +Update the project matching the <strong>projectKey</strong> supplied in the resource path. To include a custom avatar for the updated project, the project definition should contain an additional attribute with the key <code>avatar</code> and the value a data URI containing Base64-encoded image data. The URI should be in the following format: ``` data:(content type, e.g. image/png);base64,(data)``` If the data is not Base64-encoded, or if a character set is defined in the URI, or the URI is otherwise invalid, <em>project creation will fail</em>. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiUpdateProjectOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestProject) - Project parameters to update. +@return RestProject +*/ + +type ProjectApiUpdateProjectOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) UpdateProject(ctx context.Context, projectKey string, localVarOptionals *ProjectApiUpdateProjectOpts) (RestProject, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestProject + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestProject + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 201 { + var v RestProject + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Update merge strategy +Update the pull request merge strategy configuration for this project and SCM. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the context repository to call this resource. Only the strategies provided will be enabled, the default must be set and included in the set of strategies. An explicitly set pull request merge strategy configuration can be deleted by POSTing a document with an empty \"mergeConfig\" attribute. i.e: <pre>{ \"mergeConfig\": {} } </pre> Upon completion of this request, the effective configuration will be the configuration explicitly set for the SCM, or if no such explicit configuration is set then the default configuration will be used. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param scmId The SCM to get strategies for. + * @param optional nil or *ProjectApiUpdatePullRequestSettingsOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestPullRequestSettings) - The settings. +@return RestPullRequestSettings +*/ + +type ProjectApiUpdatePullRequestSettingsOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) UpdatePullRequestSettings(ctx context.Context, projectKey string, scmId string, localVarOptionals *ProjectApiUpdatePullRequestSettingsOpts) (RestPullRequestSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/pull-requests/{scmId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"scmId"+"}", fmt.Sprintf("%v", scmId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Update repository +Update the repository matching the <strong>repositorySlug</strong> supplied in the resource path. The repository's slug is derived from its name. If the name changes the slug may also change. This resource can be used to change the repository's default branch by specifying a new default branch in the request. For example: <code>\"defaultBranch\":\"main\"</code> This resource can be used to move the repository to a different project by specifying a new project in the request. For example: <code>\"project\":{\"key\":\"NEW_KEY\"}</code> The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *ProjectApiUpdateRepositoryOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestRepository) - The updated repository. +@return RestRepository +*/ + +type ProjectApiUpdateRepositoryOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) UpdateRepository(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *ProjectApiUpdateRepositoryOpts) (RestRepository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestRepository + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 403 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Update webhook +Update an existing webhook. The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param webhookId Id of the existing webhook + * @param optional nil or *ProjectApiUpdateWebhookOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestWebhook) - The representation of the updated values for the webhook +@return RestWebhook +*/ + +type ProjectApiUpdateWebhookOpts struct { + Body optional.Interface +} + +func (a *ProjectApiService) UpdateWebhook(ctx context.Context, projectKey string, webhookId string, localVarOptionals *ProjectApiUpdateWebhookOpts) (RestWebhook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestWebhook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/webhooks/{webhookId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"webhookId"+"}", fmt.Sprintf("%v", webhookId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestWebhook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +ProjectApiService Update project avatar +Update the avatar for the project matching the supplied <strong>projectKey</strong>. This resource accepts POST multipart form data, containing a single image in a form-field named 'avatar'. There are configurable server limits on both the dimensions (1024x1024 pixels by default) and uploaded file size (1MB by default). Several different image formats are supported, but <strong>PNG</strong> and <strong>JPEG</strong> are preferred due to the file size limit. This resource has Cross-Site Request Forgery (XSRF) protection. To allow the request to pass the XSRF check the caller needs to send an <code>X-Atlassian-Token</code> HTTP header with the value <code>no-check</code>. An example <a href=\"http://curl.haxx.se/\">curl</a> request to upload an image name 'avatar.png' would be: ```curl -X POST -u username:password -H \"X-Atlassian-Token: no-check\" http://example.com/rest/api/1.0/projects/STASH/avatar.png -F avatar=@avatar.png ``` The authenticated user must have <strong>PROJECT_ADMIN</strong> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *ProjectApiUploadAvatarOpts - Optional Parameters: + * @param "Avatar" (optional.*os.File) - + +*/ + +type ProjectApiUploadAvatarOpts struct { + Avatar optional.Interface +} + +func (a *ProjectApiService) UploadAvatar(ctx context.Context, projectKey string, localVarOptionals *ProjectApiUploadAvatarOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/avatar.png" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var localVarFile *os.File + if localVarOptionals != nil && localVarOptionals.Avatar.IsSet() { + localVarFileOk := false + localVarFile, localVarFileOk = localVarOptionals.Avatar.Value().(*os.File) + if !localVarFileOk { + return nil, reportError("avatar should be *os.File") + } + } + if localVarFile != nil { + fbs, _ := ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_pull_requests.go b/vendor/github.com/gdasson/bitbucketv1go/api_pull_requests.go new file mode 100644 index 000000000..a8ef7d1d3 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_pull_requests.go @@ -0,0 +1,8083 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type PullRequestsApiService service +/* +PullRequestsApiService Apply pull request suggestion +Apply a suggestion contained within a comment. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The ID of the comment to retrieve. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiApplySuggestionOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestApplySuggestionRequest) - A request containing other parameters required to apply a suggestion - The given versions/hashes must match the server's version/hashes or the suggestion application will fail (in order to avoid applying the suggestion to the wrong place + +*/ + +type PullRequestsApiApplySuggestionOpts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) ApplySuggestion(ctx context.Context, projectKey string, commentId string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiApplySuggestionOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/apply-suggestion" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Approve pull request +Approve a pull request as the current user. Implicitly adds the user as a participant if they are not already. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. <strong>Deprecated since 4.2</strong>. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} instead + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. +@return RestPullRequestParticipant +*/ +func (a *PullRequestsApiService) Approve(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (RestPullRequestParticipant, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestParticipant + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestParticipant + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Assign pull request participant role +Assigns a participant to an explicit role in pull request. Currently only the REVIEWER role may be assigned. If the user is not yet a participant in the pull request, they are made one and assigned the supplied role. If the user is already a participant in the pull request, their previous role is replaced with the supplied role unless they are already assigned the AUTHOR role which cannot be changed and will result in a Bad Request (400) response code. The authenticated user must have <strong>REPO_WRITE</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body The participant to be added to the pull request, includes the user and their role + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. +@return RestPullRequestParticipant +*/ +func (a *PullRequestsApiService) AssignParticipantRole(ctx context.Context, body RestPullRequestAssignParticipantRoleRequest, projectKey string, pullRequestId string, repositorySlug string) (RestPullRequestParticipant, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestParticipant + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestParticipant + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Test if pull request can be merged +Test whether a pull request can be merged. A pull request may not be merged if: - there are conflicts that need to be manually resolved before merging; and/or - one or more merge checks have vetoed the merge. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. +@return RestPullRequestMergeability +*/ +func (a *PullRequestsApiService) CanMerge(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (RestPullRequestMergeability, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestMergeability + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestMergeability + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Check PR rebase precondition +Checks preconditions to determine whether the pull request can be rebased. Some of the preconditions are: - The pull request is between Git repositories - The pull request is currently open - The pull request's {@link PullRequest#getFromRef \"from\" ref} is a <i>branch</i> - In other words, the qualified ID for the \"from\" ref must start with <code>refs/heads/</code> - Tags, and other non-standard refs, cannot be rebased - The current user has an e-mail address - Pull requests cannot be rebased anonymously - `git rebase` records the current user as the committer for the rebased commits, which requires a name and e-mail address - The current user has <i>write</i> access to the {@link PullRequest#getFromRef \"from\" ref}'s repository - Note that in order to <i>view</i> a pull request a user is only required to have <i>read</i> access to the {@link PullRequest#getToRef toRef}'s repository, so just because a user can <i>see</i> a pull request does not mean they can request a rebase This list is not exhaustive, and the exact set of preconditions applied can be extended by third-party add-ons. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository. + * @param repositorySlug The repository slug. +@return RestPullRequestRebaseability +*/ +func (a *PullRequestsApiService) CanRebase(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (RestPullRequestRebaseability, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestRebaseability + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/git/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/rebase" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestRebaseability + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Create pull request +Create a new pull request from a source branch or tag to a target branch. The source and target may be in the same repository, or different ones. (Note that different repositories must belong to the same <code>Repository#getHierarchyId()</code> hierarchy.) The <code>fromRef</code> may be a branch or a tag. The <code>toRef</code> is required to be a branch. Tags are not allowed as targets because tags are intended to be immutable and should not be changed after they are created. The authenticated user must have <strong>REPO_READ</strong> permission for the <code>fromRef</code> and <code>toRef</code> repositories to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiCreateOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestPullRequest) - The pull request data +@return RestPullRequest +*/ + +type PullRequestsApiCreateOpts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) Create(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PullRequestsApiCreateOpts) (RestPullRequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestPullRequest + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Create reviewer group +Create a reviewer group. The authenticated user must have <b>PROJECT_ADMIN</b> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *PullRequestsApiCreate1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestReviewerGroup) - The reviewer group to be create +@return RestReviewerGroup +*/ + +type PullRequestsApiCreate1Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) Create1(ctx context.Context, projectKey string, localVarOptionals *PullRequestsApiCreate1Opts) (RestReviewerGroup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestReviewerGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/reviewer-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestReviewerGroup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Create reviewer group +Create a reviewer group. The authenticated user must have <b>REPO_ADMIN</b> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiCreate2Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestReviewerGroup) - The request containing the details of the reviewer group. +@return RestReviewerGroup +*/ + +type PullRequestsApiCreate2Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) Create2(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PullRequestsApiCreate2Opts) (RestReviewerGroup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestReviewerGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestReviewerGroup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Add new blocker comment +Add a new blocker comment. Comments can be added in a few places by setting different attributes: General pull request blocker comment: ``` { \"text\": \"A task on a pull request.\" } ``` Blocker reply to a comment: ``` { \"text\": \"This reply is a task.\", \"parent\": { \"id\": 1 } } ``` General blocker file comment: ``` { \"text\": \"A blocker comment on a file.\", \"anchor\": { \"diffType\": \"RANGE\", \"fromHash\": \"6df3858eeb9a53a911cd17e66a9174d44ffb02cd\", \"path\": \"path/to/file\", \"srcPath\": \"path/to/file\", \"toHash\": \"04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b\" } } ``` Blocker file line comment: ``` { \"text\": \"A task on a particular line within a file.\", \"anchor\": { \"diffType\": \"COMMIT\", \"line\": 1, \"lineType\": \"CONTEXT\", \"fileType\": \"FROM\", \"fromHash\": \"6df3858eeb9a53a911cd17e66a9174d44ffb02cd\", \"path\": \"path/to/file\", \"srcPath\": \"path/to/file\", \"toHash\": \"04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b\" } } ``` For file and line comments, 'path' refers to the path of the file to which the comment should be applied and 'srcPath' refers to the path the that file used to have (only required for copies and moves). Also, fromHash and toHash refer to the sinceId / untilId (respectively) used to produce the diff on which the comment was added. Finally diffType refers to the type of diff the comment was added on. For backwards compatibility purposes if no diffType is provided and no fromHash/toHash pair is provided the diffType will be resolved to 'EFFECTIVE'. In any other cases the diffType is REQUIRED. For line comments, 'line' refers to the line in the diff that the comment should apply to. 'lineType' refers to the type of diff hunk, which can be: - 'ADDED' - for an added line; - 'REMOVED' - for a removed line; or - 'CONTEXT' - for a line that was unmodified but is in the vicinity of the diff. 'fileType' refers to the file of the diff to which the anchor should be attached - which is of relevance when displaying the diff in a side-by-side way. Currently the supported values are: - 'FROM' - the source file of the diff - 'TO' - the destination file of the diff If the current user is not a participant the user is added as a watcher of the pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiCreateComment1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestComment) - The comment to add. +@return RestComment +*/ + +type PullRequestsApiCreateComment1Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) CreateComment1(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiCreateComment1Opts) (RestComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestComment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Add pull request comment +Add a new comment. Comments can be added in a few places by setting different attributes: </p>General pull request comment: <pre> { \"text\": \"An insightful general comment on a pull request.\" } </pre> Reply to a comment: <pre> { \"text\": \"A measured reply.\", \"parent\": { \"id\": 1 } } </pre> General file comment: <pre> { \"text\": \"An insightful general comment on a file.\", \"anchor\": { \"diffType\": \"RANGE\", \"fromHash\": \"6df3858eeb9a53a911cd17e66a9174d44ffb02cd\", \"path\": \"path/to/file\", \"srcPath\": \"path/to/file\", \"toHash\": \"04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b\" } } </pre> File line comment: <pre> { \"text\": \"A pithy comment on a particular line within a file.\", \"anchor\": { \"diffType\": \"COMMIT\", \"line\": 1, \"lineType\": \"CONTEXT\", \"fileType\": \"FROM\", \"fromHash\": \"6df3858eeb9a53a911cd17e66a9174d44ffb02cd\", \"path\": \"path/to/file\", \"srcPath\": \"path/to/file\", \"toHash\": \"04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b\" } } </pre> Add a new task. Tasks are just comments with the attribute 'severity' set to 'BLOCKER': General pull request task: <pre> { \"text\": \"A task on a pull request.\", \"severity\": \"BLOCKER\" } </pre> Add a pending comment. Pending comments are just comments with the attribute 'state' set to 'PENDING': Pending comment: <pre> { \"text\": \"This is a pending comment\", \"state\": \"PENDING\" } </pre> For file and line comments, 'path' refers to the path of the file to which the comment should be applied and 'srcPath' refers to the path the that file used to have (only required for copies and moves). Also, fromHash and toHash refer to the sinceId / untilId (respectively) used to produce the diff on which the comment was added. Finally diffType refers to the type of diff the comment was added on. For backwards compatibility purposes if no diffType is provided and no fromHash/toHash pair is provided the diffType will be resolved to 'EFFECTIVE'. In any other cases the diffType is REQUIRED. For line comments, 'line' refers to the line in the diff that the comment should apply to. 'lineType' refers to the type of diff hunk, which can be: - 'ADDED' - for an added line; - 'REMOVED' - for a removed line; or - 'CONTEXT' - for a line that was unmodified but is in the vicinity of the diff. </ul>'fileType' refers to the file of the diff to which the anchor should be attached - which is of relevance when displaying the diff in a side-by-side way. Currently the supported values are: - 'FROM' - the source file of the diff - 'TO' - the destination file of the diff </ul>If the current user is not a participant the user is added as a watcher of the pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiCreateComment2Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestComment) - The comment to add +@return RestComment +*/ + +type PullRequestsApiCreateComment2Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) CreateComment2(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiCreateComment2Opts) (RestComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestComment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Create default reviewer +Create a default reviewer pull request condition for the given project. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *PullRequestsApiCreatePullRequestConditionOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestDefaultReviewersRequest) - The details needed to create a default reviewer pull request condition. +@return RestPullRequestCondition +*/ + +type PullRequestsApiCreatePullRequestConditionOpts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) CreatePullRequestCondition(ctx context.Context, projectKey string, localVarOptionals *PullRequestsApiCreatePullRequestConditionOpts) (RestPullRequestCondition, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestCondition + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/default-reviewers/latest/projects/{projectKey}/condition" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestCondition + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Create default reviewers condition +Create a default reviewer pull request condition for the given repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiCreatePullRequestCondition1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestDefaultReviewersRequest) - The details needed to create a default reviewer pull request condition. +@return RestPullRequestCondition +*/ + +type PullRequestsApiCreatePullRequestCondition1Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) CreatePullRequestCondition1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PullRequestsApiCreatePullRequestCondition1Opts) (RestPullRequestCondition, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestCondition + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/condition" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestCondition + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Decline pull request +Decline a pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pullrequest ID provided by the path + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiDeclineOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestPullRequestDeclineRequest) - The body holder + * @param "Version" (optional.String) - The current version of the pull request. If the server's version isn't the same as the specified version the operation will fail. To determine the current version of the pull request it should be fetched from the server prior to this operation. Look for the 'version' attribute in the returned JSON structure. +@return RestPullRequest +*/ + +type PullRequestsApiDeclineOpts struct { + Body optional.Interface + Version optional.String +} + +func (a *PullRequestsApiService) Decline(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiDeclineOpts) (RestPullRequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/decline" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Version.IsSet() { + localVarQueryParams.Add("version", parameterToString(localVarOptionals.Version.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequest + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Delete pull request +Deletes a pull request. To call this resource, users must be authenticated and have permission to view the pull request. Additionally, they must: - be the pull request author, if the system is configured to allow authors to delete their own pull requests (this is the default) OR - have repository administrator permission for the repository the pull request is targeting A body containing the version of the pull request must be provided with this request. `{ \"version\": 1 }` + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiDelete3Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestPullRequestDeleteRequest) - A body containing the version of the pull request + +*/ + +type PullRequestsApiDelete3Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) Delete3(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiDelete3Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Delete reviewer group +Deletes a reviewer group. The authenticated user must have <b>PROJECT_ADMIN</b> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The ID of the reviewer group to be deleted + +*/ +func (a *PullRequestsApiService) Delete4(ctx context.Context, projectKey string, id string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/reviewer-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Delete reviewer group +Deletes a reviewer group. The authenticated user must have <b>REPO_ADMIN</b> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The ID of the reviewer group to be deleted + * @param repositorySlug The repository slug. + +*/ +func (a *PullRequestsApiService) Delete5(ctx context.Context, projectKey string, id string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Delete pull request comment +Delete a pull request comment. Anyone can delete their own comment. Only users with <strong>REPO_ADMIN</strong> and above may delete comments created by other users. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The ID of the comment to retrieve. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiDeleteComment1Opts - Optional Parameters: + * @param "Version" (optional.String) - The expected version of the comment. This must match the server's version of the comment or the delete will fail. To determine the current version of the comment, the comment should be fetched from the server prior to the delete. Look for the 'version' attribute in the returned JSON structure. + +*/ + +type PullRequestsApiDeleteComment1Opts struct { + Version optional.String +} + +func (a *PullRequestsApiService) DeleteComment1(ctx context.Context, projectKey string, commentId string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiDeleteComment1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments/{commentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Version.IsSet() { + localVarQueryParams.Add("version", parameterToString(localVarOptionals.Version.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Delete a pull request comment +Delete a pull request comment. Anyone can delete their own comment. Only users with <strong>REPO_ADMIN</strong> and above may delete comments created by other users. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The ID of the comment to retrieve. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiDeleteComment2Opts - Optional Parameters: + * @param "Version" (optional.String) - The expected version of the comment. This must match the server's version of the comment or the delete will fail. To determine the current version of the comment, the comment should be fetched from the server prior to the delete. Look for the 'version' attribute in the returned JSON structure. + +*/ + +type PullRequestsApiDeleteComment2Opts struct { + Version optional.String +} + +func (a *PullRequestsApiService) DeleteComment2(ctx context.Context, projectKey string, commentId string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiDeleteComment2Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Version.IsSet() { + localVarQueryParams.Add("version", parameterToString(localVarOptionals.Version.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Remove default reviewer +Delete the default reviewer pull request condition associated with the given ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The ID of the pull request condition. + +*/ +func (a *PullRequestsApiService) DeletePullRequestCondition(ctx context.Context, projectKey string, id string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/default-reviewers/latest/projects/{projectKey}/condition/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Delete a default reviewer condition +Delete the default reviewer pull request condition associated with the given ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id + * @param repositorySlug The repository slug. + +*/ +func (a *PullRequestsApiService) DeletePullRequestCondition1(ctx context.Context, projectKey string, id int32, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Discard pull request review +Discard a pull request review for the authenticated user. The authenticated user must have <strong>REPO_READ</strong> permission for the repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + +*/ +func (a *PullRequestsApiService) DiscardReview(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/review" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Complete pull request review +Complete a review on a pull request. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiFinishReviewOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestPullRequestFinishReviewRequest) - The REST request which contains comment text and participant status + +*/ + +type PullRequestsApiFinishReviewOpts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) FinishReview(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiFinishReviewOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/review" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Get pull request +Retrieve a pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. +@return RestPullRequest +*/ +func (a *PullRequestsApiService) Get3(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (RestPullRequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequest + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get pull request activity +Retrieve a page of activity associated with a pull request. Activity items include comments, approvals, rescopes (i.e. adding and removing of commits), merges and more. Different types of activity items may be introduced in newer versions of Stash or by user installed plugins, so clients should be flexible enough to handle unexpected entity shapes in the returned page. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiGetActivitiesOpts - Optional Parameters: + * @param "FromType" (optional.String) - (required if <strong>fromId</strong> is present) the type of the activity item specified by <strong>fromId</strong> (either <strong>COMMENT</strong> or <strong>ACTIVITY</strong>) + * @param "FromId" (optional.String) - (optional) the ID of the activity item to use as the first item in the returned page + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20039 +*/ + +type PullRequestsApiGetActivitiesOpts struct { + FromType optional.String + FromId optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) GetActivities(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiGetActivitiesOpts) (InlineResponse20039, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20039 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/activities" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.FromType.IsSet() { + localVarQueryParams.Add("fromType", parameterToString(localVarOptionals.FromType.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.FromId.IsSet() { + localVarQueryParams.Add("fromId", parameterToString(localVarOptionals.FromId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20039 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get pull request comment +Retrieves a pull request comment. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The ID of the comment to retrieve + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. +@return RestComment +*/ +func (a *PullRequestsApiService) GetComment1(ctx context.Context, projectKey string, commentId string, pullRequestId string, repositorySlug string) (RestComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments/{commentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestComment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get a pull request comment +Retrieves a pull request comment. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The ID of the comment to retrieve. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. +@return RestComment +*/ +func (a *PullRequestsApiService) GetComment2(ctx context.Context, projectKey string, commentId string, pullRequestId string, repositorySlug string) (RestComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestComment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Search pull request comments +Gets comments matching the given set of field values for the specified pull request. (Note this does <b>not</b> perform any kind of searching for comments by their text). The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiGetComments1Opts - Optional Parameters: + * @param "Count" (optional.String) - If true only the count of the comments by state will be returned (and not the body of the comments). + * @param "State" (optional.Interface of []string) - + * @param "States" (optional.String) - (optional). If supplied, only comments with a state in the given list will be returned. The state can be OPEN or RESOLVED. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20036 +*/ + +type PullRequestsApiGetComments1Opts struct { + Count optional.String + State optional.Interface + States optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) GetComments1(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiGetComments1Opts) (InlineResponse20036, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20036 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Count.IsSet() { + localVarQueryParams.Add("count", parameterToString(localVarOptionals.Count.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.State.IsSet() { + localVarQueryParams.Add("state", parameterToString(localVarOptionals.State.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.States.IsSet() { + localVarQueryParams.Add("states", parameterToString(localVarOptionals.States.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20036 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get pull request comments for path +Gets comments for the specified pull request and path. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param path The path to stream comments for a given path + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiGetComments2Opts - Optional Parameters: + * @param "FromHash" (optional.String) - The from commit hash to stream comments for a RANGE or COMMIT arbitrary change scope + * @param "AnchorState" (optional.String) - ACTIVE to stream the active comments; ORPHANED to stream the orphaned comments; ALL to stream both the active and the orphaned comments; + * @param "DiffType" (optional.Interface of []string) - + * @param "ToHash" (optional.String) - The to commit hash to stream comments for a RANGE or COMMIT arbitrary change scope + * @param "State" (optional.Interface of []string) - + * @param "DiffTypes" (optional.String) - EFFECTIVE to stream the comments related to the effective diff of the pull request; RANGE to stream comments related to a commit range between two arbitrary commits (requires 'fromHash' and 'toHash'); COMMIT to stream comments related to a commit between two arbitrary commits (requires 'fromHash' and 'toHash') + * @param "States" (optional.String) - (optional). If supplied, only comments with a state in the given list will be returned. The state can be OPEN or RESOLVED. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20036 +*/ + +type PullRequestsApiGetComments2Opts struct { + FromHash optional.String + AnchorState optional.String + DiffType optional.Interface + ToHash optional.String + State optional.Interface + DiffTypes optional.String + States optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) GetComments2(ctx context.Context, path string, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiGetComments2Opts) (InlineResponse20036, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20036 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + localVarQueryParams.Add("path", parameterToString(path, "")) + if localVarOptionals != nil && localVarOptionals.FromHash.IsSet() { + localVarQueryParams.Add("fromHash", parameterToString(localVarOptionals.FromHash.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AnchorState.IsSet() { + localVarQueryParams.Add("anchorState", parameterToString(localVarOptionals.AnchorState.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.DiffType.IsSet() { + localVarQueryParams.Add("diffType", parameterToString(localVarOptionals.DiffType.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.ToHash.IsSet() { + localVarQueryParams.Add("toHash", parameterToString(localVarOptionals.ToHash.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.State.IsSet() { + localVarQueryParams.Add("state", parameterToString(localVarOptionals.State.Value(), "multi")) + } + if localVarOptionals != nil && localVarOptionals.DiffTypes.IsSet() { + localVarQueryParams.Add("diffTypes", parameterToString(localVarOptionals.DiffTypes.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.States.IsSet() { + localVarQueryParams.Add("states", parameterToString(localVarOptionals.States.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20036 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get commit message suggestion +Retrieve a suggested commit message for the given Pull Request. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request to generate the suggestion for + * @param repositorySlug The repository slug. +@return RestCommitMessageSuggestion +*/ +func (a *PullRequestsApiService) GetCommitMessageSuggestion(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (RestCommitMessageSuggestion, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestCommitMessageSuggestion + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/commit-message-suggestion" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestCommitMessageSuggestion + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get pull request commits +Retrieve commits for the specified pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId ID of the pullrequest, part of the path + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiGetCommits1Opts - Optional Parameters: + * @param "AvatarScheme" (optional.String) - The desired scheme for the avatar URL. If the parameter is not present URLs will use the same scheme as this request + * @param "WithCounts" (optional.String) - If set to true, the service will add \"authorCount\" and \"totalCount\" at the end of the page. \"authorCount\" is the number of different authors and \"totalCount\" is the total number of commits. + * @param "AvatarSize" (optional.String) - If present the service adds avatar URLs for commit authors. Should be an integer specifying the desired size in pixels. If the parameter is not present, avatar URLs will not be setCOMMIT to stream comments related to a commit between two arbitrary commits (requires 'fromHash' and 'toHash') + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20035 +*/ + +type PullRequestsApiGetCommits1Opts struct { + AvatarScheme optional.String + WithCounts optional.String + AvatarSize optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) GetCommits1(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiGetCommits1Opts) (InlineResponse20035, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20035 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/commits" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.AvatarScheme.IsSet() { + localVarQueryParams.Add("avatarScheme", parameterToString(localVarOptionals.AvatarScheme.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.WithCounts.IsSet() { + localVarQueryParams.Add("withCounts", parameterToString(localVarOptionals.WithCounts.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AvatarSize.IsSet() { + localVarQueryParams.Add("avatarSize", parameterToString(localVarOptionals.AvatarSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20035 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get merge strategies +Retrieve the merge strategies available for this instance. The user must be authenticated to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param scmId the id of the scm to get strategies for +@return RestPullRequestMergeConfig +*/ +func (a *PullRequestsApiService) GetMergeConfig(ctx context.Context, scmId string) (RestPullRequestMergeConfig, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestMergeConfig + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/pull-requests/{scmId}" + localVarPath = strings.Replace(localVarPath, "{"+"scmId"+"}", fmt.Sprintf("%v", scmId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestMergeConfig + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get pull requests for repository +Retrieve a page of pull requests to or from the specified repository. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. Optionally clients can specify PR participant filters. Each filter has a mandatory username.N parameter, and the optional role.N and approved.N parameters. - username.N - the \"root\" of a single participant filter, where \"N\" is a natural number starting from 1. This allows clients to specify multiple participant filters, by providing consecutive filters as username.1, username.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 participant filters is 10 and all filters exceeding that limit will be dropped. - role.N(optional) the role associated with username.N. This must be one of AUTHOR, REVIEWER, or PARTICIPANT - approved.N (optional) the approved status associated with username.N. That is whether username.N has approved the PR. Either true, or false + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiGetPageOpts - Optional Parameters: + * @param "WithAttributes" (optional.String) - (optional) defaults to true, whether to return additional pull request attributes + * @param "At" (optional.String) - (optional) a <i>fully-qualified</i> branch ID to find pull requests to or from, such as refs/heads/master + * @param "WithProperties" (optional.String) - (optional) defaults to true, whether to return additional pull request properties + * @param "FilterText" (optional.String) - (optional) If specified, only pull requests where the title or description contains the supplied string will be returned. + * @param "State" (optional.String) - (optional, defaults to <strong>OPEN</strong>). Supply <strong>ALL</strong> to return pull request in any state. If a state is supplied only pull requests in the specified state will be returned. Either <strong>OPEN</strong>, <strong>DECLINED</strong> or <strong>MERGED</strong>. + * @param "Order" (optional.String) - (optional, defaults to <strong>NEWEST</strong>) the order to return pull requests in, either <strong>OLDEST</strong> (as in: \"oldest first\") or <strong>NEWEST</strong>. + * @param "Direction" (optional.String) - (optional, defaults to <strong>INCOMING</strong>) the direction relative to the specified repository. Either <strong>INCOMING</strong> or <strong>OUTGOING</strong>. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20022 +*/ + +type PullRequestsApiGetPageOpts struct { + WithAttributes optional.String + At optional.String + WithProperties optional.String + FilterText optional.String + State optional.String + Order optional.String + Direction optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) GetPage(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PullRequestsApiGetPageOpts) (InlineResponse20022, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20022 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/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 localVarOptionals != nil && localVarOptionals.WithAttributes.IsSet() { + localVarQueryParams.Add("withAttributes", parameterToString(localVarOptionals.WithAttributes.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.WithProperties.IsSet() { + localVarQueryParams.Add("withProperties", parameterToString(localVarOptionals.WithProperties.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.FilterText.IsSet() { + localVarQueryParams.Add("filterText", parameterToString(localVarOptionals.FilterText.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.State.IsSet() { + localVarQueryParams.Add("state", parameterToString(localVarOptionals.State.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Direction.IsSet() { + localVarQueryParams.Add("direction", parameterToString(localVarOptionals.Direction.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20022 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get default reviewers +Return a page of default reviewer pull request conditions that have been configured for this project. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. +@return []RestPullRequestCondition +*/ +func (a *PullRequestsApiService) GetPullRequestConditions(ctx context.Context, projectKey string) ([]RestPullRequestCondition, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []RestPullRequestCondition + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/default-reviewers/latest/projects/{projectKey}/conditions" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v []RestPullRequestCondition + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get configured default reviewers +Return a page of default reviewer pull request conditions that have been configured for this repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return []RestPullRequestCondition +*/ +func (a *PullRequestsApiService) GetPullRequestConditions1(ctx context.Context, projectKey string, repositorySlug string) ([]RestPullRequestCondition, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []RestPullRequestCondition + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/conditions" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v []RestPullRequestCondition + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get repository pull requests containing commit +Retrieve a page of pull requests in the current repository that contain the given commit. The user must be authenticated and have access to the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commitId the commit ID + * @param repositorySlug The repository slug + * @param optional nil or *PullRequestsApiGetPullRequestsOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20022 +*/ + +type PullRequestsApiGetPullRequestsOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) GetPullRequests(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *PullRequestsApiGetPullRequestsOpts) (InlineResponse20022, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20022 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/pull-requests" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20022 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get pull request comment thread +Get the <code>CommentThread</code> threads which have <code>Comment</code> comments that have a <code>CommentState#PENDING</code> pending state and are part of the pull request review for the authenticated user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiGetReviewOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20036 +*/ + +type PullRequestsApiGetReviewOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) GetReview(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiGetReviewOpts) (InlineResponse20036, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20036 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/review" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20036 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get reviewer group +Retrieve a reviewer group. The authenticated user must have <b>PROJECT_READ</b> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The ID of the reviewer group to be retrieved +@return RestReviewerGroup +*/ +func (a *PullRequestsApiService) GetReviewerGroup(ctx context.Context, projectKey string, id string) (RestReviewerGroup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestReviewerGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/reviewer-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestReviewerGroup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get reviewer group +Retrieve a reviewer group. The authenticated user must have <b>REPO_READ</b> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The ID of the reviewer group to be retrieved + * @param repositorySlug The repository slug. +@return RestReviewerGroup +*/ +func (a *PullRequestsApiService) GetReviewerGroup1(ctx context.Context, projectKey string, id string, repositorySlug string) (RestReviewerGroup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestReviewerGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestReviewerGroup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get all reviewer groups +Retrieve a page of reviewer groups of a given scope. The authenticated user must have <b>PROJECT_READ</b> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *PullRequestsApiGetReviewerGroupsOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20045 +*/ + +type PullRequestsApiGetReviewerGroupsOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) GetReviewerGroups(ctx context.Context, projectKey string, localVarOptionals *PullRequestsApiGetReviewerGroupsOpts) (InlineResponse20045, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20045 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/reviewer-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20045 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get all reviewer groups +Retrieve a page of reviewer groups of a given scope. The authenticated user must have <b>REPO_READ</b> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiGetReviewerGroups1Opts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20045 +*/ + +type PullRequestsApiGetReviewerGroups1Opts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) GetReviewerGroups1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PullRequestsApiGetReviewerGroups1Opts) (InlineResponse20045, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20045 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups" + 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 localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20045 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get required reviewers for PR creation +Return a set of users who are required reviewers for pull requests created from the given source repository and ref to the given target ref in this repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiGetReviewersOpts - Optional Parameters: + * @param "TargetRepoId" (optional.String) - The ID of the repository in which the target ref exists + * @param "SourceRepoId" (optional.String) - The ID of the repository in which the source ref exists + * @param "SourceRefId" (optional.String) - The ID of the source ref + * @param "TargetRefId" (optional.String) - The ID of the target ref +@return []RestPullRequestCondition +*/ + +type PullRequestsApiGetReviewersOpts struct { + TargetRepoId optional.String + SourceRepoId optional.String + SourceRefId optional.String + TargetRefId optional.String +} + +func (a *PullRequestsApiService) GetReviewers(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PullRequestsApiGetReviewersOpts) ([]RestPullRequestCondition, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []RestPullRequestCondition + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/reviewers" + 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 localVarOptionals != nil && localVarOptionals.TargetRepoId.IsSet() { + localVarQueryParams.Add("targetRepoId", parameterToString(localVarOptionals.TargetRepoId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SourceRepoId.IsSet() { + localVarQueryParams.Add("sourceRepoId", parameterToString(localVarOptionals.SourceRepoId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SourceRefId.IsSet() { + localVarQueryParams.Add("sourceRefId", parameterToString(localVarOptionals.SourceRefId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.TargetRefId.IsSet() { + localVarQueryParams.Add("targetRefId", parameterToString(localVarOptionals.TargetRefId.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v []RestPullRequestCondition + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v RestErrors + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get reviewer group users +Retrieve a list of the users of a reviewer group. This does not return all the users of the group, only the users who have <b>REPO_READ</b> permission for the specified repository. The authenticated user must have <b>REPO_READ</b> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The ID of the reviewer group to be retrieved + * @param repositorySlug The repository slug. +@return []RestApplicationUser +*/ +func (a *PullRequestsApiService) GetUsers(ctx context.Context, projectKey string, id string, repositorySlug string) ([]RestApplicationUser, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []RestApplicationUser + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups/{id}/users" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v []RestApplicationUser + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v RestErrors + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v RestErrors + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Get pull request participants +Retrieves a page of the participants for a given pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiListParticipantsOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20040 +*/ + +type PullRequestsApiListParticipantsOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) ListParticipants(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiListParticipantsOpts) (InlineResponse20040, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20040 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20040 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Merge pull request +Merge the specified pull request. The authenticated user must have <strong>REPO_WRITE</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiMergeOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestPullRequestMergeRequest) - The body holder + * @param "Version" (optional.String) - The current version of the pull request. If the server's version isn't the same as the specified version the operation will fail. To determine the current version of the pull request it should be fetched from the server prior to this operation. Look for the 'version' attribute in the returned JSON structure. +@return RestPullRequest +*/ + +type PullRequestsApiMergeOpts struct { + Body optional.Interface + Version optional.String +} + +func (a *PullRequestsApiService) Merge(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiMergeOpts) (RestPullRequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/merge" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Version.IsSet() { + localVarQueryParams.Add("version", parameterToString(localVarOptionals.Version.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequest + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService React to a PR comment +Add an emoticon reaction to a pull request comment + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The comment id. + * @param pullRequestId The pull request id. + * @param emoticon The emoticon to add + * @param repositorySlug The repository slug. +@return RestUserReaction +*/ +func (a *PullRequestsApiService) React1(ctx context.Context, projectKey string, commentId string, pullRequestId string, emoticon string, repositorySlug string) (RestUserReaction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestUserReaction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/reactions/{emoticon}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"emoticon"+"}", fmt.Sprintf("%v", emoticon), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestUserReaction + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Rebase pull request +Rebases the specified pull request, rewriting the incoming commits to start from the tip commit of the pull request's target branch. <i>This operation alters the pull request's source branch and cannot be undone.</i> The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets <i>and</i> <strong>REPO_WRITE</strong> permission for the pull request's source repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiRebaseOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestPullRequestRebaseRequest) - The pull request rebase request. +@return RestPullRequestRebaseResult +*/ + +type PullRequestsApiRebaseOpts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) Rebase(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiRebaseOpts) (RestPullRequestRebaseResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestRebaseResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/git/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/rebase" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestRebaseResult + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Re-open pull request +Re-open a declined pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiReopenOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestPullRequestReopenRequest) - The body holder + * @param "Version" (optional.String) - The current version of the pull request. If the server's version isn't the same as the specified version the operation will fail. To determine the current version of the pull request it should be fetched from the server prior to this operation. Look for the 'version' attribute in the returned JSON structure. +@return RestPullRequest +*/ + +type PullRequestsApiReopenOpts struct { + Body optional.Interface + Version optional.String +} + +func (a *PullRequestsApiService) Reopen(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiReopenOpts) (RestPullRequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/reopen" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Version.IsSet() { + localVarQueryParams.Add("version", parameterToString(localVarOptionals.Version.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequest + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Search pull request participants +Retrieve a page of participant users for all the pull requests to or from the specified repository. Optionally clients can specify following filters. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiSearchOpts - Optional Parameters: + * @param "Filter" (optional.String) - (optional) Return only users, whose username, name or email address <i>contain</i> the filter value + * @param "Role" (optional.String) - (optional) The role associated with the pull request participant. This must be one of AUTHOR, REVIEWER, or PARTICIPANT + * @param "Direction" (optional.String) - (optional), Defaults to <strong>INCOMING</strong>) the direction relative to the specified repository. Either <strong>INCOMING</strong> or <strong>OUTGOING</strong>. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2005 +*/ + +type PullRequestsApiSearchOpts struct { + Filter optional.String + Role optional.String + Direction optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) Search(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *PullRequestsApiSearchOpts) (InlineResponse2005, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2005 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/participants" + 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 localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Role.IsSet() { + localVarQueryParams.Add("role", parameterToString(localVarOptionals.Role.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Direction.IsSet() { + localVarQueryParams.Add("direction", parameterToString(localVarOptionals.Direction.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2005 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Update merge strategies +Update the pull request merge strategies for the context repository. The authenticated user must have <strong>ADMIN</strong> permission to call this resource. Only the strategies provided will be enabled, only one may be set to default The commit message template will not be updated if not provided, and will be deleted if the `commitMessageTemplate` attribute is empty, i.e: `commitMessageTemplate: {}`. An explicitly set pull request merge strategy configuration can be deleted by POSTing a document with an empty `mergeConfig` attribute. i.e: ``` { \"mergeConfig\": {} } ``` Upon completion of this request, the effective configuration will be the default configuration. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param scmId the id of the scm to get strategies for + * @param optional nil or *PullRequestsApiSetMergeConfigOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestPullRequestSettings) - the settings +@return RestPullRequestMergeConfig +*/ + +type PullRequestsApiSetMergeConfigOpts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) SetMergeConfig(ctx context.Context, scmId string, localVarOptionals *PullRequestsApiSetMergeConfigOpts) (RestPullRequestMergeConfig, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestMergeConfig + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/pull-requests/{scmId}" + localVarPath = strings.Replace(localVarPath, "{"+"scmId"+"}", fmt.Sprintf("%v", scmId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestMergeConfig + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Gets pull request changes +Gets changes for the specified PullRequest. If the changeScope query parameter is set to 'UNREVIEWED', the application will attempt to stream unreviewed changes based on the lastReviewedCommit of the current user, which are the changes between the lastReviewedCommit and the latest commit of the source branch. The current user is considered to <i>not</i> have any unreviewed changes for the pull request when the lastReviewedCommit is either null (everything is unreviewed, so all changes are streamed), equal to the latest commit of the source branch (everything is reviewed), or no longer on the source branch (the source branch has been rebased). In these cases, the application will fall back to streaming all changes (the default), which is the effective diff for the pull request. The type of changes streamed can be determined by the changeScope parameter included in the properties map of the response. Note: This resource is currently <i>not paged</i>. The server will return at most one page. The server will truncate the number of changes to either the request's page limit or an internal maximum, whichever is smaller. The start parameter of the page request is also ignored. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiStreamChanges1Opts - Optional Parameters: + * @param "SinceId" (optional.String) - The since commit hash to stream changes for a RANGE arbitrary change scope + * @param "ChangeScope" (optional.String) - UNREVIEWED to stream the unreviewed changes for the current user (if they exist); RANGE to stream changes between two arbitrary commits (requires 'sinceId' and 'untilId'); otherwise ALL to stream all changes (the default) + * @param "UntilId" (optional.String) - The until commit hash to stream changes for a RANGE arbitrary change scope + * @param "WithComments" (optional.String) - true to apply comment counts in the changes (the default); otherwise, false to stream changes without comment counts + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return RestChange +*/ + +type PullRequestsApiStreamChanges1Opts struct { + SinceId optional.String + ChangeScope optional.String + UntilId optional.String + WithComments optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) StreamChanges1(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiStreamChanges1Opts) (RestChange, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestChange + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/changes" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SinceId.IsSet() { + localVarQueryParams.Add("sinceId", parameterToString(localVarOptionals.SinceId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ChangeScope.IsSet() { + localVarQueryParams.Add("changeScope", parameterToString(localVarOptionals.ChangeScope.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.UntilId.IsSet() { + localVarQueryParams.Add("untilId", parameterToString(localVarOptionals.UntilId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.WithComments.IsSet() { + localVarQueryParams.Add("withComments", parameterToString(localVarOptionals.WithComments.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestChange + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Stream a diff within a pull request +Streams a diff within a pull request. If the specified file has been copied, moved or renamed, the <code>srcPath</code> must also be specified to produce the correct diff. To stream a raw text representation of the diff, this endpoint can be called with the request header 'Accept: text/plain'. Note: This RESTful endpoint is currently <i>not paged</i>. The server will internally apply a hard cap to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param path The path to the file which should be diffed (optional) + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiStreamDiff2Opts - Optional Parameters: + * @param "AvatarScheme" (optional.String) - The security scheme for avatar URLs. If the scheme is not present then it is inherited from the request. It can be set to \"https\" to force the use of secure URLs. Not applicable if streaming raw diff + * @param "ContextLines" (optional.String) - The number of context lines to include around added/removed lines in the diff + * @param "SinceId" (optional.String) - The since commit hash to stream a diff between two arbitrary hashes + * @param "SrcPath" (optional.String) - The previous path to the file, if the file has been copied, moved or renamed + * @param "DiffType" (optional.String) - The type of diff being requested. When withComments is true this works as a hint to the system to attach the correct set of comments to the diff. Not applicable if streaming raw diff + * @param "UntilId" (optional.String) - The until commit hash to stream a diff between two arbitrary hashes + * @param "Whitespace" (optional.String) - Optional whitespace flag which can be set to <code>ignore-all</code> + * @param "WithComments" (optional.String) - <code>true</code> to embed comments in the diff (the default); otherwise, <code>false</code> to stream the diff without comments. Not applicable if streaming raw diff + * @param "AvatarSize" (optional.String) - If present the service adds avatar URLs for comment authors where the provided value specifies the desired avatar size in pixels. Not applicable if streaming raw diff + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20037 +*/ + +type PullRequestsApiStreamDiff2Opts struct { + AvatarScheme optional.String + ContextLines optional.String + SinceId optional.String + SrcPath optional.String + DiffType optional.String + UntilId optional.String + Whitespace optional.String + WithComments optional.String + AvatarSize optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *PullRequestsApiService) StreamDiff2(ctx context.Context, path string, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiStreamDiff2Opts) (InlineResponse20037, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20037 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/diff/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.AvatarScheme.IsSet() { + localVarQueryParams.Add("avatarScheme", parameterToString(localVarOptionals.AvatarScheme.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ContextLines.IsSet() { + localVarQueryParams.Add("contextLines", parameterToString(localVarOptionals.ContextLines.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SinceId.IsSet() { + localVarQueryParams.Add("sinceId", parameterToString(localVarOptionals.SinceId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SrcPath.IsSet() { + localVarQueryParams.Add("srcPath", parameterToString(localVarOptionals.SrcPath.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.DiffType.IsSet() { + localVarQueryParams.Add("diffType", parameterToString(localVarOptionals.DiffType.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.UntilId.IsSet() { + localVarQueryParams.Add("untilId", parameterToString(localVarOptionals.UntilId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Whitespace.IsSet() { + localVarQueryParams.Add("whitespace", parameterToString(localVarOptionals.Whitespace.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.WithComments.IsSet() { + localVarQueryParams.Add("withComments", parameterToString(localVarOptionals.WithComments.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AvatarSize.IsSet() { + localVarQueryParams.Add("avatarSize", parameterToString(localVarOptionals.AvatarSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20037 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Stream pull request as patch +Streams a patch representing a pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + +*/ +func (a *PullRequestsApiService) StreamPatch1(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}.patch" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Stream raw pull request diff +Streams the raw diff for a pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiStreamRawDiff2Opts - Optional Parameters: + * @param "ContextLines" (optional.String) - The number of context lines to include around added/removed lines in the diff + * @param "Whitespace" (optional.String) - optional whitespace flag which can be set to <code>ignore-all</code> + +*/ + +type PullRequestsApiStreamRawDiff2Opts struct { + ContextLines optional.String + Whitespace optional.String +} + +func (a *PullRequestsApiService) StreamRawDiff2(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiStreamRawDiff2Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}.diff" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.ContextLines.IsSet() { + localVarQueryParams.Add("contextLines", parameterToString(localVarOptionals.ContextLines.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Whitespace.IsSet() { + localVarQueryParams.Add("whitespace", parameterToString(localVarOptionals.Whitespace.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"text/plain", "text/html"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Remove a reaction from a PR comment +Remove an emoticon reaction from a pull request comment + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The comment id. + * @param pullRequestId The pull request id. + * @param emoticon The emoticon to remove + * @param repositorySlug The repository slug. + +*/ +func (a *PullRequestsApiService) UnReact1(ctx context.Context, projectKey string, commentId string, pullRequestId string, emoticon string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}/reactions/{emoticon}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"emoticon"+"}", fmt.Sprintf("%v", emoticon), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Unassign pull request participant +Unassigns a participant from the REVIEWER role they may have been given in a pull request. If the participant has no explicit role this method has no effect. Afterwards, the user will still remain a participant in the pull request but their role will be reduced to PARTICIPANT. This is because once made a participant of a pull request, a user will forever remain a participant. Only their role may be altered. The authenticated user must have <strong>REPO_WRITE</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param userSlug The slug for the user being unassigned + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + +*/ +func (a *PullRequestsApiService) UnassignParticipantRole(ctx context.Context, projectKey string, userSlug string, pullRequestId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Unassign pull request participant +Unassigns a participant from the REVIEWER role they may have been given in a pull request. If the participant has no explicit role this method has no effect. Afterwards, the user will still remain a participant in the pull request but their role will be reduced to PARTICIPANT. This is because once made a participant of a pull request, a user will forever remain a participant. Only their role may be altered. The authenticated user must have <strong>REPO_WRITE</strong> permission for the repository that this pull request targets to call this resource. <strong>Deprecated since 4.2</strong>. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} instead. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiUnassignParticipantRole1Opts - Optional Parameters: + * @param "Username" (optional.String) - + +*/ + +type PullRequestsApiUnassignParticipantRole1Opts struct { + Username optional.String +} + +func (a *PullRequestsApiService) UnassignParticipantRole1(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiUnassignParticipantRole1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Username.IsSet() { + localVarQueryParams.Add("username", parameterToString(localVarOptionals.Username.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Stop watching pull request +Remove the authenticated user as a watcher for the specified pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + +*/ +func (a *PullRequestsApiService) Unwatch1(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/watch" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Update pull request metadata +Update the title, description, reviewers or destination branch of an existing pull request. **Note:** the <em>reviewers</em> list may be updated using this resource. However the <em>author</em> and <em>participants</em> list may not. The authenticated user must either: - be the author of the pull request and have the <strong>REPO_READ</strong> permission for the repository that this pull request targets; or - have the <strong>REPO_WRITE</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiUpdateOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestPullRequest) - The updated pull request +@return RestPullRequest +*/ + +type PullRequestsApiUpdateOpts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) Update(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiUpdateOpts) (RestPullRequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequest + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Update reviewer group attributes +Update the attributes of a reviewer group. The authenticated user must have <b>PROJECT_READ</b> permission for the specified project to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The ID of the reviewer group to be updated + * @param optional nil or *PullRequestsApiUpdate1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestReviewerGroup) - The request containing the attributes of the reviewer group to be updated. Only the attributes to be updated need to be present in this object. +@return RestReviewerGroup +*/ + +type PullRequestsApiUpdate1Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) Update1(ctx context.Context, projectKey string, id string, localVarOptionals *PullRequestsApiUpdate1Opts) (RestReviewerGroup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestReviewerGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/settings/reviewer-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestReviewerGroup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Update reviewer group attributes +Update the attributes of a reviewer group. The authenticated user must have <b>REPO_ADMIN</b> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The ID of the reviewer group to be updated + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiUpdate2Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestReviewerGroup) - The request containing the attributes of the reviewer group to be updated. Only the attributes to be updated need to be present in this object. +@return RestReviewerGroup +*/ + +type PullRequestsApiUpdate2Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) Update2(ctx context.Context, projectKey string, id string, repositorySlug string, localVarOptionals *PullRequestsApiUpdate2Opts) (RestReviewerGroup, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestReviewerGroup + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/reviewer-groups/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestReviewerGroup + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Update pull request comment +Update a comment, with the following restrictions: - only the author of the comment may update the <i>text</i> of the comment - only the author of the comment, the author of the pull request or repository admins and above may update the other fields of a comment Convert a comment to a task or vice versa. Comments can be converted to tasks by setting the 'severity' attribute to 'BLOCKER': ``` { \"severity\": \"BLOCKER\" } ``` Tasks can be converted to comments by setting the 'severity' attribute to 'NORMAL': ``` { \"severity\": \"NORMAL\" } ``` Resolve a blocker comment. Blocker comments can be resolved by setting the 'state' attribute to 'RESOLVED': ``` { \"state\": \"RESOLVED\" } ``` <strong>Note:</strong> the supplied JSON object must contain a <code>version</code> that must match the server's version of the comment or the update will fail. To determine the current version of the comment, the comment should be fetched from the server prior to the update. Look for the 'version' attribute in the returned JSON structure. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The ID of the comment to retrieve. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiUpdateComment1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestComment) - The comment to add. +@return RestComment +*/ + +type PullRequestsApiUpdateComment1Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) UpdateComment1(ctx context.Context, projectKey string, commentId string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiUpdateComment1Opts) (RestComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/blocker-comments/{commentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestComment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Update pull request comment +Update a comment, with the following restrictions: - only the author of the comment may update the <i>text</i> of the comment - only the author of the comment, the author of the pull request or repository admins and above may update the other fields of a comment </ul> Convert a comment to a task or vice versa. Comments can be converted to tasks by setting the 'severity' attribute to 'BLOCKER': <pre> { \"severity\": \"BLOCKER\" } </pre> Tasks can be converted to comments by setting the 'severity' attribute to 'NORMAL': <pre> { \"severity\": \"NORMAL\" } </pre> Resolve a task. Tasks can be resolved by setting the 'state' attribute to 'RESOLVED': <pre> { \"state\": \"RESOLVED\" } </pre> <strong>Note:</strong> the supplied JSON object must contain a <code>version</code> that must match the server's version of the comment or the update will fail. To determine the current version of the comment, the comment should be fetched from the server prior to the update. Look for the 'version' attribute in the returned JSON structure. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The ID of the comment to retrieve. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiUpdateComment2Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestComment) - The updated comment +@return RestComment +*/ + +type PullRequestsApiUpdateComment2Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) UpdateComment2(ctx context.Context, projectKey string, commentId string, pullRequestId string, repositorySlug string, localVarOptionals *PullRequestsApiUpdateComment2Opts) (RestComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestComment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Update the default reviewer +Update the default reviewer pull request condition for the given ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The ID of the pull request condition. + * @param optional nil or *PullRequestsApiUpdatePullRequestConditionOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestDefaultReviewersRequest) - The new details for the default reviewer pull request condition. +@return RestPullRequestCondition +*/ + +type PullRequestsApiUpdatePullRequestConditionOpts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) UpdatePullRequestCondition(ctx context.Context, projectKey string, id string, localVarOptionals *PullRequestsApiUpdatePullRequestConditionOpts) (RestPullRequestCondition, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestCondition + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/default-reviewers/latest/projects/{projectKey}/condition/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestCondition + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Update a default reviewer condition +Update the default reviewer pull request condition for the given ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The ID of the pull request condition + * @param repositorySlug The repository slug. + * @param optional nil or *PullRequestsApiUpdatePullRequestCondition1Opts - Optional Parameters: + * @param "Body" (optional.Interface of ConditionIdBody) - +@return RestPullRequestCondition +*/ + +type PullRequestsApiUpdatePullRequestCondition1Opts struct { + Body optional.Interface +} + +func (a *PullRequestsApiService) UpdatePullRequestCondition1(ctx context.Context, projectKey string, id string, repositorySlug string, localVarOptionals *PullRequestsApiUpdatePullRequestCondition1Opts) (RestPullRequestCondition, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestCondition + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/default-reviewers/latest/projects/{projectKey}/repos/{repositorySlug}/condition/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestCondition + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Change pull request status +Change the current user's status for a pull request. Implicitly adds the user as a participant if they are not already. If the current user is the author, this method will fail. The possible values for {@code status} are <strong>UNAPPROVED</strong>, <strong>NEEDS_WORK</strong> (which is referred to as \"Requested changes\" in the frontend from 8.10 onward), or <strong>APPROVED</strong>. If the new {@code status} is <strong>NEEDS_WORK</strong> or <strong>APPROVED</strong> then the {@code lastReviewedCommit} for the participant will be updated to the latest commit of the source branch of the pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body The participant representing the status to set, includes the status of the participant + * @param projectKey The project key. + * @param userSlug The slug for the user changing their status + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. +@return RestPullRequestParticipant +*/ +func (a *PullRequestsApiService) UpdateStatus(ctx context.Context, body RestPullRequestAssignStatusRequest, projectKey string, userSlug string, pullRequestId string, repositorySlug string) (RestPullRequestParticipant, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestParticipant + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestParticipant + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +PullRequestsApiService Watch pull request +Add the authenticated user as a watcher for the specified pull request. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The pull request ID. + * @param repositorySlug The repository slug. + +*/ +func (a *PullRequestsApiService) Watch1(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/watch" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +PullRequestsApiService Unapprove pull request +Remove approval from a pull request as the current user. This does not remove the user as a participant. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource. <strong>Deprecated since 4.2</strong>. Use /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug} instead + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param pullRequestId The ID of the pull request within the repository + * @param repositorySlug The repository slug. +@return RestPullRequestParticipant +*/ +func (a *PullRequestsApiService) WithdrawApproval(ctx context.Context, projectKey string, pullRequestId string, repositorySlug string) (RestPullRequestParticipant, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestPullRequestParticipant + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/approve" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestPullRequestParticipant + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_repository.go b/vendor/github.com/gdasson/bitbucketv1go/api_repository.go new file mode 100644 index 000000000..f9e788b73 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_repository.go @@ -0,0 +1,10139 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type RepositoryApiService service +/* +RepositoryApiService Add repository label +Applies a label to the repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiAddLabelOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestLabel) - The label to apply +@return RestLabel +*/ + +type RepositoryApiAddLabelOpts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) AddLabel(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiAddLabelOpts) (RestLabel, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestLabel + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestLabel + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Create branch + Creates a branch in the specified repository. The authenticated user must have an effective <strong>REPO_WRITE</strong> permission to call this resource. If branch permissions are set up in the repository, the authenticated user must also have access to the branch name that is to be created. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return RestBranch +*/ +func (a *RepositoryApiService) CreateBranch(ctx context.Context, body RestBranchCreateRequest, projectKey string, repositorySlug string) (RestBranch, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestBranch + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestBranch + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Create branch +Creates a branch using the information provided in the RestCreateBranchRequest request The authenticated user must have <strong>REPO_WRITE</strong> permission for the context repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiCreateBranchForRepositoryOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestCreateBranchRequest) - The request to create a branch containing a <strong>name</strong>, <strong>startPoint</strong>, and optionally a <strong>message</strong> +@return RestBranch +*/ + +type RepositoryApiCreateBranchForRepositoryOpts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) CreateBranchForRepository(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiCreateBranchForRepositoryOpts) (RestBranch, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestBranch + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestBranch + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Add a new commit comment +Add a new comment. Comments can be added in a few places by setting different attributes: General commit comment: ```{ \"text\": \"An insightful general comment on a commit.\" } </pre> Reply to a comment: <pre>{ \"text\": \"A measured reply.\", \"parent\": { \"id\": 1 } } </pre> General file comment: <pre>{ \"text\": \"An insightful general comment on a file.\", \"anchor\": { \"diffType\": \"COMMIT\", \"fromHash\": \"6df3858eeb9a53a911cd17e66a9174d44ffb02cd\", \"path\": \"path/to/file\", \"srcPath\": \"path/to/file\", \"toHash\": \"04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b\" } } </pre> File line comment: <pre>{ \"text\": \"A pithy comment on a particular line within a file.\", \"anchor\": { \"diffType\": \"COMMIT\", \"line\": 1, \"lineType\": \"CONTEXT\", \"fileType\": \"FROM\", \"fromHash\": \"6df3858eeb9a53a911cd17e66a9174d44ffb02cd\", \"path\": \"path/to/file\", \"srcPath\": \"path/to/file\", \"toHash\": \"04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b\" } } ``` Note: general file comments are an experimental feature and may change in the near future! For file and line comments, 'path' refers to the path of the file to which the comment should be applied and 'srcPath' refers to the path the that file used to have (only required for copies and moves). Also, fromHash and toHash refer to the sinceId / untilId (respectively) used to produce the diff on which the comment was added. Finally diffType refers to the type of diff the comment was added on. For line comments, 'line' refers to the line in the diff that the comment should apply to. 'lineType' refers to the type of diff hunk, which can be:- 'ADDED' - for an added line;</li>- 'REMOVED' - for a removed line; or</li>- 'CONTEXT' - for a line that was unmodified but is in the vicinity of the diff.</li>'fileType' refers to the file of the diff to which the anchor should be attached - which is of relevance when displaying the diff in a side-by-side way. Currently the supported values are:- 'FROM' - the source file of the diff</li>- 'TO' - the destination file of the diff</li>If the current user is not a participant the user is added as one and updated to watch the commit. The authenticated user must have REPO_READ permission for the repository that the commit is in to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commitId The <i>full ID</i> of the commit within the repository + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiCreateCommentOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestComment) - the comment + * @param "Since" (optional.String) - For a merge commit, a parent can be provided to specify which diff the comments should be on. For a commit range, a sinceId can be provided to specify where the comments should be anchored from. +@return RestComment +*/ + +type RepositoryApiCreateCommentOpts struct { + Body optional.Interface + Since optional.String +} + +func (a *RepositoryApiService) CreateComment(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *RepositoryApiCreateCommentOpts) (RestComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Since.IsSet() { + localVarQueryParams.Add("since", parameterToString(localVarOptionals.Since.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestComment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Create multiple ref restrictions +Allows creating multiple restrictions at once. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiCreateRestrictions1Opts - Optional Parameters: + * @param "Body" (optional.Interface of []RestRestrictionRequest) - The request containing a list of the details of the restrictions to create. +@return RestRefRestriction +*/ + +type RepositoryApiCreateRestrictions1Opts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) CreateRestrictions1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiCreateRestrictions1Opts) (RestRefRestriction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRefRestriction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/vnd.atl.bitbucket.bulk+json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRefRestriction + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Create tag +Creates a tag in the specified repository. The authenticated user must have an effective <strong>REPO_WRITE</strong> permission to call this resource. 'LIGHTWEIGHT' and 'ANNOTATED' are the two type of tags that can be created. The 'startPoint' can either be a ref or a 'commit'. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiCreateTagOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestGitTagCreateRequest) - The create git tag request. +@return RestTag +*/ + +type RepositoryApiCreateTagOpts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) CreateTag(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiCreateTagOpts) (RestTag, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestTag + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 201 { + var v RestTag + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Create tag +Creates a tag using the information provided in the RestCreateTagRequest request The authenticated user must have <strong>REPO_WRITE</strong> permission for the context repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiCreateTagForRepositoryOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestCreateTagRequest) - The request to create a tag containing a <strong>name</strong>, <strong>startPoint</strong>, and optionally a <strong>message</strong> +@return RestTag +*/ + +type RepositoryApiCreateTagForRepositoryOpts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) CreateTagForRepository(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiCreateTagForRepositoryOpts) (RestTag, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestTag + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestTag + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Create webhook +Create a webhook for the repository specified via the URL. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiCreateWebhook1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestWebhook) - The webhook to be created for this repository. +@return RestWebhook +*/ + +type RepositoryApiCreateWebhook1Opts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) CreateWebhook1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiCreateWebhook1Opts) (RestWebhook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestWebhook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestWebhook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Delete an attachment +Delete an attachment. The user must be authenticated and have <strong>REPO_ADMIN</strong> permission for the specified repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param attachmentId the attachment ID + * @param repositorySlug The repository slug + +*/ +func (a *RepositoryApiService) DeleteAttachment(ctx context.Context, projectKey string, attachmentId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"attachmentId"+"}", fmt.Sprintf("%v", attachmentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Delete attachment metadata +Delete attachment metadata. The user must be authenticated and have <strong>REPO_ADMIN</strong> permission for the specified repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param attachmentId the attachment ID + * @param repositorySlug The repository slug + +*/ +func (a *RepositoryApiService) DeleteAttachmentMetadata(ctx context.Context, projectKey string, attachmentId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"attachmentId"+"}", fmt.Sprintf("%v", attachmentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Delete auto decline settings +Delete auto decline settings for the supplied repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for this repository to call the resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param repositorySlug The repository slug + +*/ +func (a *RepositoryApiService) DeleteAutoDeclineSettings1(ctx context.Context, projectKey string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Delete branch + Deletes a branch in the specified repository. If the branch does not exist, this operation will not raise an error. In other words after calling this resource and receiving a 204 response the branch provided in the request is guaranteed to not exist in the specified repository any more, regardless of its existence beforehand. The optional 'endPoint' parameter of the request may contain a commit ID that the provided ref name is expected to point to. Should the ref point to a different commit ID, a 400 response will be returned with appropriate error details. The authenticated user must have an effective <strong>REPO_WRITE</strong> permission to call this resource. If branch permissions are set up in the repository, the authenticated user must also have access to the branch name that is to be deleted. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiDeleteBranchOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestBranchDeleteRequest) - Branch delete request + +*/ + +type RepositoryApiDeleteBranchOpts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) DeleteBranch(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiDeleteBranchOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Delete a commit comment +Delete a commit comment. Anyone can delete their own comment. Only users with <strong>REPO_ADMIN</strong> and above may delete comments created by other users. Comments which have replies <i>may not be deleted</i>, regardless of the user's granted permissions. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that the commit is in to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commentId the comment + * @param commitId The <i>full ID</i> of the commit within the repository + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiDeleteCommentOpts - Optional Parameters: + * @param "Version" (optional.String) - The expected version of the comment. This must match the server's version of the comment or the delete will fail. To determine the current version of the comment, the comment should be fetched from the server prior to the delete. Look for the 'version' attribute in the returned JSON structure. + +*/ + +type RepositoryApiDeleteCommentOpts struct { + Version optional.String +} + +func (a *RepositoryApiService) DeleteComment(ctx context.Context, projectKey string, commentId string, commitId string, repositorySlug string, localVarOptionals *RepositoryApiDeleteCommentOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Version.IsSet() { + localVarQueryParams.Add("version", parameterToString(localVarOptionals.Version.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Delete repository hook +Delete repository hook configuration for the supplied <strong>hookKey</strong> and <strong>repositorySlug</strong> The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The hook key. + * @param repositorySlug The repository slug. + +*/ +func (a *RepositoryApiService) DeleteRepositoryHook(ctx context.Context, projectKey string, hookKey string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Delete a ref restriction +Deletes a restriction as specified by a restriction id. The authenticated user must have <strong>REPO_ADMIN</strong> permission or higher to call this resource. Only authenticated users may call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The restriction id. + * @param repositorySlug The repository slug. + +*/ +func (a *RepositoryApiService) DeleteRestriction1(ctx context.Context, projectKey string, id string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Delete tag +Deletes a tag in the specified repository. The authenticated user must have an effective <strong>REPO_WRITE</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param name The name of the tag to be deleted. + * @param repositorySlug The repository slug. + +*/ +func (a *RepositoryApiService) DeleteTag(ctx context.Context, projectKey string, name string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/git/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Delete webhook +Delete a webhook for the repository specified via the URL. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param webhookId The ID of the webhook to be deleted. + * @param repositorySlug The repository slug. + +*/ +func (a *RepositoryApiService) DeleteWebhook1(ctx context.Context, projectKey string, webhookId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"webhookId"+"}", fmt.Sprintf("%v", webhookId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Disable repository hook +Disable a repository hook for this repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The hook key. + * @param repositorySlug The repository slug. +@return RestRepositoryHook +*/ +func (a *RepositoryApiService) DisableHook1(ctx context.Context, projectKey string, hookKey string, repositorySlug string) (RestRepositoryHook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryHook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryHook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Edit file +Update the content of path, on the given repository and branch. This resource accepts PUT multipart form data, containing the file in a form-field named content. An example <a href=\"http://curl.haxx.se/\">curl</a> request to update 'README.md' would be: ```curl -X PUT -u username:password -F content=@README.md -F 'message=Updated using file-edit REST API' -F branch=master -F sourceCommitId=5636641a50b http://example.com/rest/api/latest/projects/PROJECT_1/repos/repo_1/browse/README.md ``` - branch: the branch on which the path should be modified or created - content: the full content of the file at path - message: the message associated with this change, to be used as the commit message. Or null if the default message should be used. - sourceCommitId: the commit ID of the file before it was edited, used to identify if content has changed. Or null if this is a new file The file can be updated or created on a new branch. In this case, the sourceBranch parameter should be provided to identify the starting point for the new branch and the branch parameter identifies the branch to create the new commit on. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param path The path of the file that is to be modified or created + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiEditFileOpts - Optional Parameters: + * @param "Branch" (optional.String) - + * @param "Content" (optional.String) - + * @param "Message" (optional.String) - + * @param "SourceBranch" (optional.String) - + * @param "SourceCommitId" (optional.String) - +@return RestCommit +*/ + +type RepositoryApiEditFileOpts struct { + Branch optional.String + Content optional.String + Message optional.String + SourceBranch optional.String + SourceCommitId optional.String +} + +func (a *RepositoryApiService) EditFile(ctx context.Context, path string, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiEditFileOpts) (RestCommit, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestCommit + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.Branch.IsSet() { + localVarFormParams.Add("branch", parameterToString(localVarOptionals.Branch.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Content.IsSet() { + localVarFormParams.Add("content", parameterToString(localVarOptionals.Content.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Message.IsSet() { + localVarFormParams.Add("message", parameterToString(localVarOptionals.Message.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SourceBranch.IsSet() { + localVarFormParams.Add("sourceBranch", parameterToString(localVarOptionals.SourceBranch.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SourceCommitId.IsSet() { + localVarFormParams.Add("sourceCommitId", parameterToString(localVarOptionals.SourceCommitId.Value(), "")) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestCommit + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Enable repository hook +Enable a repository hook for this repository and optionally apply new configuration. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. A JSON document may be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The hook key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiEnableHook1Opts - Optional Parameters: + * @param "ContentLength" (optional.String) - The content length. +@return RestRepositoryHook +*/ + +type RepositoryApiEnableHook1Opts struct { + ContentLength optional.String +} + +func (a *RepositoryApiService) EnableHook1(ctx context.Context, projectKey string, hookKey string, repositorySlug string, localVarOptionals *RepositoryApiEnableHook1Opts) (RestRepositoryHook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryHook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.ContentLength.IsSet() { + localVarHeaderParams["Content-Length"] = parameterToString(localVarOptionals.ContentLength.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryHook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get branches with ref change activities for repository +Retrieve a page of branches with ref change activities for a specific repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiFindBranchesOpts - Optional Parameters: + * @param "FilterText" (optional.String) - (optional) Partial match for a ref ID to filter minimal refs for + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2003 +*/ + +type RepositoryApiFindBranchesOpts struct { + FilterText optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) FindBranches(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiFindBranchesOpts) (InlineResponse2003, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2003 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities/branches" + 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 localVarOptionals != nil && localVarOptionals.FilterText.IsSet() { + localVarQueryParams.Add("filterText", parameterToString(localVarOptionals.FilterText.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2003 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get branch +Gets the branch information associated with a single commit from a given repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commitId + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiFindByCommitOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2003 +*/ + +type RepositoryApiFindByCommitOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) FindByCommit(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *RepositoryApiFindByCommitOpts) (InlineResponse2003, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2003 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-utils/latest/projects/{projectKey}/repos/{repositorySlug}/branches/info/{commitId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(commitId) > 40 { + return localVarReturnValue, nil, reportError("commitId must have less than 40 elements") + } + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2003 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 500 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Find webhooks +Find webhooks in this repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiFindWebhooks1Opts - Optional Parameters: + * @param "Event" (optional.String) - List of <code>com.atlassian.webhooks.WebhookEvent</code> IDs to filter for + * @param "Statistics" (optional.Bool) - <code>true</code> if statistics should be provided for all found webhooks + +*/ + +type RepositoryApiFindWebhooks1Opts struct { + Event optional.String + Statistics optional.Bool +} + +func (a *RepositoryApiService) FindWebhooks1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiFindWebhooks1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks" + 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 localVarOptionals != nil && localVarOptionals.Event.IsSet() { + localVarQueryParams.Add("event", parameterToString(localVarOptionals.Event.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Statistics.IsSet() { + localVarQueryParams.Add("statistics", parameterToString(localVarOptionals.Statistics.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Get repository labels +Get all labels applied to the given repository. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return RestLabel +*/ +func (a *RepositoryApiService) GetAllLabelsForRepository(ctx context.Context, projectKey string, repositorySlug string) (RestLabel, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestLabel + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestLabel + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Stream archive of repository +Streams an archive of the repository's contents at the requested commit. If no `at=` commit is requested, an archive of the default branch is streamed. The <code>filename=</code> query parameter may be used to specify the exact filename to include in the \"Content-Disposition\" header. If an explicit filename is not provided, one will be automatically generated based on what is being archived. Its format depends on the at= value: - No <code>at=</code> commit: &lt;slug&gt;-&lt;default-branch-name&gt;@&lt;commit&gt;.&lt;format&gt;; e.g. example-master@43c2f8a0fe8.zip - <code>at=</code>sha: &lt;slug&gt;-&lt;at&gt;.&lt;format&gt;; e.g. example-09bcbb00100cfbb5310fb6834a1d5ce6cac253e9.tar.gz - <code>at=</code>branchOrTag: &lt;slug&gt;-&lt;branchOrTag&gt;@&lt;commit&gt;.&lt;format&gt;; e.g. example-feature@bbb225f16e1.tar - If the branch or tag is qualified (e.g. refs/heads/master, the short name (master) will be included in the filename - If the branch or tag's <i>short name</i> includes slashes (e.g. release/4.6), they will be converted to hyphens in the filename (release-4.5) Archives may be requested in the following formats by adding the <code>format=</code> query parameter: - zip: A zip file using standard compression (Default) - tar: An uncompressed tarball - tar.gz or tgz: A GZip-compressed tarball The contents of the archive may be filtered by using the <code>path=</code> query parameter to specify paths to include. <code>path=</code> may be specified multiple times to include multiple paths. The <code>prefix=</code> query parameter may be used to define a directory (or multiple directories) where the archive's contents should be placed. If the prefix does not end with /, one will be added automatically. The prefix is <i>always</i> treated as a directory; it is not possible to use it to prepend characters to the entries in the archive. Archives of public repositories may be streamed by any authenticated or anonymous user. Streaming archives for non-public repositories requires an <i>authenticated user</i> with at least <b>REPO_READ</b> permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetArchiveOpts - Optional Parameters: + * @param "Path" (optional.String) - Paths to include in the streamed archive; may be repeated to include multiple paths + * @param "Filename" (optional.String) - A filename to include the \"Content-Disposition\" header + * @param "At" (optional.String) - The commit to stream an archive of; if not supplied, an archive of the default branch is streamed + * @param "Prefix" (optional.String) - A prefix to apply to all entries in the streamed archive; if the supplied prefix does not end with a trailing /, one will be added automatically + * @param "Format" (optional.String) - The format to stream the archive in; must be one of: zip, tar, tar.gz or tgz + +*/ + +type RepositoryApiGetArchiveOpts struct { + Path optional.String + Filename optional.String + At optional.String + Prefix optional.String + Format optional.String +} + +func (a *RepositoryApiService) GetArchive(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetArchiveOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/archive" + 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 localVarOptionals != nil && localVarOptionals.Path.IsSet() { + localVarQueryParams.Add("path", parameterToString(localVarOptionals.Path.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Filename.IsSet() { + localVarQueryParams.Add("filename", parameterToString(localVarOptionals.Filename.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Prefix.IsSet() { + localVarQueryParams.Add("prefix", parameterToString(localVarOptionals.Prefix.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Format.IsSet() { + localVarQueryParams.Add("format", parameterToString(localVarOptionals.Format.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Get an attachment +Retrieve the attachment. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository that is associated to the attachment. Range requests (see IETF RFC7233) are supported. However only a single range issupported. If multiple ranges are passed the ranges will be ignored and the entire content will be returned in the response. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param attachmentId the attachment ID + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiGetAttachmentOpts - Optional Parameters: + * @param "UserAgent" (optional.String) - + * @param "Range_" (optional.String) - + +*/ + +type RepositoryApiGetAttachmentOpts struct { + UserAgent optional.String + Range_ optional.String +} + +func (a *RepositoryApiService) GetAttachment(ctx context.Context, projectKey string, attachmentId string, repositorySlug string, localVarOptionals *RepositoryApiGetAttachmentOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"attachmentId"+"}", fmt.Sprintf("%v", attachmentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.UserAgent.IsSet() { + localVarHeaderParams["User-Agent"] = parameterToString(localVarOptionals.UserAgent.Value(), "") + } + if localVarOptionals != nil && localVarOptionals.Range_.IsSet() { + localVarHeaderParams["Range"] = parameterToString(localVarOptionals.Range_.Value(), "") + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Get attachment metadata +Retrieve the attachment metadata. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository that is associated to the attachment that has the attachment metadata. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param attachmentId the attachment ID + * @param repositorySlug The repository slug +@return RestAttachmentMetadata +*/ +func (a *RepositoryApiService) GetAttachmentMetadata(ctx context.Context, projectKey string, attachmentId string, repositorySlug string) (RestAttachmentMetadata, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAttachmentMetadata + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"attachmentId"+"}", fmt.Sprintf("%v", attachmentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAttachmentMetadata + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get auto decline settings +Retrieves the auto decline settings for the supplied repository. Project settings will be returned if no explicit settings have been set for the repository. In the case that there are no project settings, the default settings will be returned. The authenticated user must have <strong>REPO_READ</strong> permission for this repository to call the resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param repositorySlug The repository slug +@return RestAutoDeclineSettings +*/ +func (a *RepositoryApiService) GetAutoDeclineSettings1(ctx context.Context, projectKey string, repositorySlug string) (RestAutoDeclineSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAutoDeclineSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAutoDeclineSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Find branches +Retrieve the branches matching the supplied <strong>filterText</strong> param. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetBranchesOpts - Optional Parameters: + * @param "BoostMatches" (optional.Bool) - Controls whether exact and prefix matches will be boosted to the top + * @param "OrderBy" (optional.String) - Ordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated) + * @param "Details" (optional.Bool) - Whether to retrieve plugin-provided metadata about each branch + * @param "FilterText" (optional.String) - The text to match on + * @param "Base" (optional.String) - Base branch or tag to compare each branch to (for the metadata providers that uses that information + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20033 +*/ + +type RepositoryApiGetBranchesOpts struct { + BoostMatches optional.Bool + OrderBy optional.String + Details optional.Bool + FilterText optional.String + Base optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetBranches(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetBranchesOpts) (InlineResponse20033, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20033 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches" + 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 localVarOptionals != nil && localVarOptionals.BoostMatches.IsSet() { + localVarQueryParams.Add("boostMatches", parameterToString(localVarOptionals.BoostMatches.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.OrderBy.IsSet() { + localVarQueryParams.Add("orderBy", parameterToString(localVarOptionals.OrderBy.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Details.IsSet() { + localVarQueryParams.Add("details", parameterToString(localVarOptionals.Details.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.FilterText.IsSet() { + localVarQueryParams.Add("filterText", parameterToString(localVarOptionals.FilterText.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Base.IsSet() { + localVarQueryParams.Add("base", parameterToString(localVarOptionals.Base.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20033 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get changes in commit +Retrieve a page of changes made in a specified commit. <strong>Note:</strong> The implementation will apply a hard cap (<code>page.max.changes</code>) and it is not possible to request subsequent content when that cap is exceeded. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commitId The commit to retrieve changes for + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiGetChangesOpts - Optional Parameters: + * @param "WithComments" (optional.String) - <code>true</code> to apply comment counts in the changes (the default); otherwise, <code>false</code> to stream changes without comment counts + * @param "Since" (optional.String) - The commit to which <code>until</code> should be compared to produce a page of changes. If not specified the commit's first parent is assumed (if one exists) + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20034 +*/ + +type RepositoryApiGetChangesOpts struct { + WithComments optional.String + Since optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetChanges(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *RepositoryApiGetChangesOpts) (InlineResponse20034, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20034 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/changes" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.WithComments.IsSet() { + localVarQueryParams.Add("withComments", parameterToString(localVarOptionals.WithComments.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Since.IsSet() { + localVarQueryParams.Add("since", parameterToString(localVarOptionals.Since.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20034 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get changes made in commit +Retrieve a page of changes made in a specified commit. <strong>Note:</strong> The implementation will apply a hard cap ({@code page.max.changes}) and it is not possible to request subsequent content when that cap is exceeded. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetChanges1Opts - Optional Parameters: + * @param "Until" (optional.String) - The commit to retrieve changes for + * @param "Since" (optional.String) - The commit to which <code>until</code> should be compared to produce a page of changes. If not specified the commit's first parent is assumed (if one exists) + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20034 +*/ + +type RepositoryApiGetChanges1Opts struct { + Until optional.String + Since optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetChanges1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetChanges1Opts) (InlineResponse20034, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20034 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/changes" + 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 localVarOptionals != nil && localVarOptionals.Until.IsSet() { + localVarQueryParams.Add("until", parameterToString(localVarOptionals.Until.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Since.IsSet() { + localVarQueryParams.Add("since", parameterToString(localVarOptionals.Since.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20034 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get a commit comment +Retrieves a commit discussion comment. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that the commit is in to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commentId The ID of the comment to retrieve + * @param commitId The <i>full ID</i> of the commit within the repository + * @param repositorySlug The repository slug +@return RestComment +*/ +func (a *RepositoryApiService) GetComment(ctx context.Context, projectKey string, commentId string, commitId string, repositorySlug string) (RestComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestComment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Search for commit comments +Retrieves the commit discussion comments that match the specified search criteria. It is possible to retrieve commit discussion comments that are anchored to a range of commits by providing the sinceId that the comments anchored from. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that the commit is in to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commitId The <i>full ID</i> of the commit within the repository + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiGetCommentsOpts - Optional Parameters: + * @param "Path" (optional.String) - The path to the file on which comments were made + * @param "Since" (optional.String) - For a merge commit, a parent can be provided to specify which diff the comments are on. For a commit range, a sinceId can be provided to specify where the comments are anchored from. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20036 +*/ + +type RepositoryApiGetCommentsOpts struct { + Path optional.String + Since optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetComments(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *RepositoryApiGetCommentsOpts) (InlineResponse20036, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20036 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Path.IsSet() { + localVarQueryParams.Add("path", parameterToString(localVarOptionals.Path.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Since.IsSet() { + localVarQueryParams.Add("since", parameterToString(localVarOptionals.Since.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20036 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get commit by ID +Retrieve a single commit <i>identified by its ID</i>. In general, that ID is a SHA1. <u>From 2.11, ref names like \"refs/heads/master\" are no longer accepted by this resource.</u> The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commitId The commit ID to retrieve + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiGetCommitOpts - Optional Parameters: + * @param "Path" (optional.String) - An optional path to filter the commit by. If supplied the details returned <i>may not</i> be for the specified commit. Instead, starting from the specified commit, they will be the details for the first commit affecting the specified path. +@return RestCommit +*/ + +type RepositoryApiGetCommitOpts struct { + Path optional.String +} + +func (a *RepositoryApiService) GetCommit(ctx context.Context, projectKey string, commitId string, repositorySlug string, localVarOptionals *RepositoryApiGetCommitOpts) (RestCommit, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestCommit + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Path.IsSet() { + localVarQueryParams.Add("path", parameterToString(localVarOptionals.Path.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestCommit + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get commits +Retrieve a page of commits from a given starting commit or \"between\" two commits. If no explicit commit is specified, the tip of the repository's default branch is assumed. commits may be identified by branch or tag name or by ID. A path may be supplied to restrict the returned commits to only those which affect that path. The authenticated user must have <b>REPO_READ</b> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiGetCommitsOpts - Optional Parameters: + * @param "AvatarScheme" (optional.String) - The desired scheme for the avatar URL. If the parameter is not present URLs will use the same scheme as this request + * @param "Path" (optional.String) - An optional path to filter commits by + * @param "WithCounts" (optional.String) - Optionally include the total number of commits and total number of unique authors + * @param "FollowRenames" (optional.String) - If <code>true</code>, the commit history of the specified file will be followed past renames. Only valid for a path to a single file. + * @param "Until" (optional.String) - The commit ID (SHA1) or ref (inclusively) to retrieve commits before + * @param "AvatarSize" (optional.String) - If present the service adds avatar URLs for commit authors. Should be an integer specifying the desired size in pixels. If the parameter is not present, avatar URLs will not be set + * @param "Since" (optional.String) - The commit ID or ref (exclusively) to retrieve commits after + * @param "Merges" (optional.String) - If present, controls how merge commits should be filtered. Can be either <code>exclude</code>, to exclude merge commits, <code>include</code>, to include both merge commits and non-merge commits or <code>only</code>, to only return merge commits. + * @param "IgnoreMissing" (optional.String) - <code>true</code> to ignore missing commits, <code>false</code> otherwise + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20035 +*/ + +type RepositoryApiGetCommitsOpts struct { + AvatarScheme optional.String + Path optional.String + WithCounts optional.String + FollowRenames optional.String + Until optional.String + AvatarSize optional.String + Since optional.String + Merges optional.String + IgnoreMissing optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetCommits(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetCommitsOpts) (InlineResponse20035, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20035 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits" + 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 localVarOptionals != nil && localVarOptionals.AvatarScheme.IsSet() { + localVarQueryParams.Add("avatarScheme", parameterToString(localVarOptionals.AvatarScheme.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Path.IsSet() { + localVarQueryParams.Add("path", parameterToString(localVarOptionals.Path.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.WithCounts.IsSet() { + localVarQueryParams.Add("withCounts", parameterToString(localVarOptionals.WithCounts.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.FollowRenames.IsSet() { + localVarQueryParams.Add("followRenames", parameterToString(localVarOptionals.FollowRenames.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Until.IsSet() { + localVarQueryParams.Add("until", parameterToString(localVarOptionals.Until.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AvatarSize.IsSet() { + localVarQueryParams.Add("avatarSize", parameterToString(localVarOptionals.AvatarSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Since.IsSet() { + localVarQueryParams.Add("since", parameterToString(localVarOptionals.Since.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Merges.IsSet() { + localVarQueryParams.Add("merges", parameterToString(localVarOptionals.Merges.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IgnoreMissing.IsSet() { + localVarQueryParams.Add("ignoreMissing", parameterToString(localVarOptionals.IgnoreMissing.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20035 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get hook scripts +Return a page of hook scripts configured for the specified repository. This endpoint requires **REPO_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetConfigurations1Opts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20031 +*/ + +type RepositoryApiGetConfigurations1Opts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetConfigurations1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetConfigurations1Opts) (InlineResponse20031, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20031 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts" + 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 localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20031 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get file content at revision +Retrieve a page of content for a file path at a specified revision. Responses from this endpoint vary widely depending on the query parameters. The example JSON is for a request that does not use size, type, blame or noContent. 1. size will return a response like {\"size\":10000} 2. type will return a response like {\"type\":\"FILE\"}, where possible values are \"DIRECTORY\", \"FILE\" and \"SUBMODULE\" 3. blame <i>without</i> noContent will include blame for the lines of content returned on the page 4. blame <i>with</i> noContent will omit file contents and only return blame for the requested lines 5. noContent without blame is ignored and does nothing The various parameters are \"processed\" in the above order. That means ?size=true&amp;type=truewill return a size response, not a type one; the type parameter will be ignored. The blame and noContent query parameters are handled differently from size and type. For blame and noContent, the <i>presence</i> of the parameter implies \"true\" if no value is specified; size and and type both require an explicit=true or they're treated as \"false\". - ?blame is the same as ?blame=true - ?blame&amp;noContent is the same as ?blame=true&amp;noContent=true - ?size is the same as ?size=false - ?type is the same as ?type=false The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetContentOpts - Optional Parameters: + * @param "NoContent" (optional.String) - If blame&amp;noContent only the blame is retrieved instead of the contents + * @param "At" (optional.String) - The commit ID or ref to retrieve the content for + * @param "Size" (optional.String) - If true only the size will be returned for the file path instead of the contents + * @param "Blame" (optional.String) - If present and not equal to 'false', the blame will be returned for the file as well + * @param "Type_" (optional.String) - If true only the type will be returned for the file path instead of the contents + +*/ + +type RepositoryApiGetContentOpts struct { + NoContent optional.String + At optional.String + Size optional.String + Blame optional.String + Type_ optional.String +} + +func (a *RepositoryApiService) GetContent(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetContentOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse" + 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 localVarOptionals != nil && localVarOptionals.NoContent.IsSet() { + localVarQueryParams.Add("noContent", parameterToString(localVarOptionals.NoContent.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Size.IsSet() { + localVarQueryParams.Add("size", parameterToString(localVarOptionals.Size.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Blame.IsSet() { + localVarQueryParams.Add("blame", parameterToString(localVarOptionals.Blame.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Get file content +Retrieve a page of content for a file path at a specified revision. Responses from this endpoint vary widely depending on the query parameters. The example JSON is for a request that does not use size, type, blame or noContent. 1. size will return a response like {\"size\":10000} 2. type will return a response like {\"type\":\"FILE\"}, where possible values are \"DIRECTORY\", \"FILE\" and \"SUBMODULE\" 3. blame <i>without</i> noContent will include blame for the lines of content returned on the page 4. blame <i>with</i> noContent will omit file contents and only return blame for the requested lines 5. noContent without blame is ignored and does nothing The various parameters are \"processed\" in the above order. That means ?size=true&amp;type=truewill return a size response, not a type one; the type parameter will be ignored. The blame and noContent query parameters are handled differently from size and type. For blame and noContent, the <i>presence</i> of the parameter implies \"true\" if no value is specified; size and and type both require an explicit=true or they're treated as \"false\". - ?blame is the same as ?blame=true - ?blame&amp;noContent is the same as ?blame=true&amp;noContent=true - ?size is the same as ?size=false - ?type is the same as ?type=false The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param path The file path to retrieve content from + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetContent1Opts - Optional Parameters: + * @param "NoContent" (optional.String) - If blame&amp;noContent only the blame is retrieved instead of the contents + * @param "At" (optional.String) - The commit ID or ref to retrieve the content for + * @param "Size" (optional.String) - If true only the size will be returned for the file path instead of the contents + * @param "Blame" (optional.String) - If present and not equal to 'false', the blame will be returned for the file as well + * @param "Type_" (optional.String) - If true only the type will be returned for the file path instead of the contents + +*/ + +type RepositoryApiGetContent1Opts struct { + NoContent optional.String + At optional.String + Size optional.String + Blame optional.String + Type_ optional.String +} + +func (a *RepositoryApiService) GetContent1(ctx context.Context, path string, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetContent1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/browse/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + 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 localVarOptionals != nil && localVarOptionals.NoContent.IsSet() { + localVarQueryParams.Add("noContent", parameterToString(localVarOptionals.NoContent.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Size.IsSet() { + localVarQueryParams.Add("size", parameterToString(localVarOptionals.Size.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Blame.IsSet() { + localVarQueryParams.Add("blame", parameterToString(localVarOptionals.Blame.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Get default branch +Retrieves the repository's default branch, if it has been created. If the repository is empty, 204 No Content will be returned. For non-empty repositories, if the configured default branch has not yet been created a 404 Not Found will be returned. This URL is deprecated. Callers should use <code>GET /projects/{key}/repos/{slug}/default-branch</code> instead, which allows retrieving the <i>configured</i> default branch even if the ref has not been created yet. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return RestBranch +*/ +func (a *RepositoryApiService) GetDefaultBranch1(ctx context.Context, projectKey string, repositorySlug string) (RestBranch, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestBranch + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches/default" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestBranch + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get last webhook invocation details +Get the latest invocations for a specific webhook. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param webhookId ID of the webhook + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetLatestInvocation1Opts - Optional Parameters: + * @param "Event" (optional.String) - The string ID of a specific event to retrieve the last invocation for. + * @param "Outcome" (optional.String) - The outcome to filter for. Can be SUCCESS, FAILURE, ERROR. None specified means that the all will be considered +@return RestDetailedInvocation +*/ + +type RepositoryApiGetLatestInvocation1Opts struct { + Event optional.String + Outcome optional.String +} + +func (a *RepositoryApiService) GetLatestInvocation1(ctx context.Context, projectKey string, webhookId string, repositorySlug string, localVarOptionals *RepositoryApiGetLatestInvocation1Opts) (RestDetailedInvocation, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestDetailedInvocation + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}/latest" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"webhookId"+"}", fmt.Sprintf("%v", webhookId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Event.IsSet() { + localVarQueryParams.Add("event", parameterToString(localVarOptionals.Event.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Outcome.IsSet() { + localVarQueryParams.Add("outcome", parameterToString(localVarOptionals.Outcome.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestDetailedInvocation + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get pull request settings +Retrieve the pull request settings for the context repository. The authenticated user must have <strong>REPO_READ</strong> permission for the context repository to call this resource. This resource will call all RestFragments that are registered with the key <strong>bitbucket.repository.settings.pullRequests</strong>. If any fragment fails validations by returning a non-empty Map of errors, then no fragments will execute. The property keys for the settings that are bundled with the application are - mergeConfig - the merge strategy configuration for pull requests - requiredApprovers - (Deprecated, please use com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook instead) the number of approvals required on a pull request for it to be mergeable, or 0 if the merge check is disabled - com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook - the merge check configuration for required approvers - requiredAllApprovers - whether or not all approvers must approve a pull request for it to be mergeable - requiredAllTasksComplete - whether or not all tasks on a pull request need to be completed for it to be mergeable - requiredSuccessfulBuilds - (Deprecated, please use com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck instead) the number of successful builds on a pull request for it to be mergeable, or 0 if the merge check is disabled - com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck - the merge check configuration for required builds + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return RestRepositoryPullRequestSettings +*/ +func (a *RepositoryApiService) GetPullRequestSettings1(ctx context.Context, projectKey string, repositorySlug string) (RestRepositoryPullRequestSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryPullRequestSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryPullRequestSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get ref change activity +Retrieve a page of repository ref change activity. The authenticated user must have <strong>REPO_ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetRefChangeActivityOpts - Optional Parameters: + * @param "Ref" (optional.String) - (optional) exact match for a ref ID to filter ref change activity for + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20041 +*/ + +type RepositoryApiGetRefChangeActivityOpts struct { + Ref optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetRefChangeActivity(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetRefChangeActivityOpts) (InlineResponse20041, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20041 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/ref-change-activities" + 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 localVarOptionals != nil && localVarOptionals.Ref.IsSet() { + localVarQueryParams.Add("ref", parameterToString(localVarOptionals.Ref.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20041 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Search for repositories +Retrieve a page of repositories based on query parameters that control the search. See the documentation of the parameters for more details. This resource is anonymously accessible. <b>Note on permissions.</b> In absence of the <code>permission</code> query parameter the implicit 'read' permission is assumed. Please note that this permission is lower than the <tt>REPO_READ</tt> permission rather than being equal to it. The implicit 'read' permission for a given repository is assigned to any user that has any of the higher permissions, such as <tt>REPO_READ</tt>, as well as to anonymous users if the repository is marked as public. The important implication of the above is that an anonymous request to this resource with a permission level <tt>REPO_READ</tt> is guaranteed to receive an empty list of repositories as a result. For anonymous requests it is therefore recommended to not specify the <tt>permission</tt> parameter at all. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *RepositoryApiGetRepositories1Opts - Optional Parameters: + * @param "Archived" (optional.String) - (optional) if specified, this will limit the resulting repository list to ones whose are <tt>ACTIVE</tt>, <tt>ARCHIVED</tt> or <tt>ALL</tt> for both. The match performed is case-insensitive. This filter defaults to <tt>ACTIVE</tt> when not set. <em>Available since 8.0</em> + * @param "Projectname" (optional.String) - (optional) if specified, this will limit the resulting repository list to ones whose project's name matches this parameter's value. The match performed is case-insensitive and any leading and/or trailing whitespace characters on the <code>projectname</code> parameter will be stripped. + * @param "Projectkey" (optional.String) - (optional) if specified, this will limit the resulting repository list to ones whose project's key matches this parameter's value. The match performed is case-insensitive and any leading and/or trailing whitespace characters on the <code>projectKey</code> parameter will be stripped. <em>Available since 8.0</em> + * @param "Visibility" (optional.String) - (optional) if specified, this will limit the resulting repository list based on the repositories visibility. Valid values are <em>public</em> or <em>private</em>. + * @param "Name" (optional.String) - (optional) if specified, this will limit the resulting repository list to ones whose name matches this parameter's value. The match performed is case-insensitive and any leading and/or trailing whitespace characters on the <code>name</code> parameter will be stripped. + * @param "Permission" (optional.String) - (optional) if specified, it must be a valid repository permission level name and will limit the resulting repository list to ones that the requesting user has the specified permission level to. If not specified, the default implicit 'read' permission level will be assumed. The currently supported explicit permission values are <tt>REPO_READ</tt>, <tt>REPO_WRITE</tt> and <tt>REPO_ADMIN</tt>. + * @param "State" (optional.String) - (optional) if specified, it must be a valid repository state name and will limit the resulting repository list to ones that are in the specified state. The currently supported explicit state values are <tt>AVAILABLE</tt>, <tt>INITIALISING</tt> and <tt>INITIALISATION_FAILED</tt>.<br> <em>Available since 5.13</em> + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20029 +*/ + +type RepositoryApiGetRepositories1Opts struct { + Archived optional.String + Projectname optional.String + Projectkey optional.String + Visibility optional.String + Name optional.String + Permission optional.String + State optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetRepositories1(ctx context.Context, localVarOptionals *RepositoryApiGetRepositories1Opts) (InlineResponse20029, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20029 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/repos" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Archived.IsSet() { + localVarQueryParams.Add("archived", parameterToString(localVarOptionals.Archived.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Projectname.IsSet() { + localVarQueryParams.Add("projectname", parameterToString(localVarOptionals.Projectname.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Projectkey.IsSet() { + localVarQueryParams.Add("projectkey", parameterToString(localVarOptionals.Projectkey.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Visibility.IsSet() { + localVarQueryParams.Add("visibility", parameterToString(localVarOptionals.Visibility.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Name.IsSet() { + localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Permission.IsSet() { + localVarQueryParams.Add("permission", parameterToString(localVarOptionals.Permission.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.State.IsSet() { + localVarQueryParams.Add("state", parameterToString(localVarOptionals.State.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20029 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get recently accessed repositories +Retrieve a page of recently accessed repositories for the currently authenticated user. Repositories are ordered from most recently to least recently accessed. <p>Only authenticated users may call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *RepositoryApiGetRepositoriesRecentlyAccessedOpts - Optional Parameters: + * @param "Permission" (optional.String) - (optional) If specified, it must be a valid repository permission level name and will limit the resulting repository list to ones that the requesting user has the specified permission level to. If not specified, the default <code>REPO_READ</code> permission level will be assumed. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20029 +*/ + +type RepositoryApiGetRepositoriesRecentlyAccessedOpts struct { + Permission optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetRepositoriesRecentlyAccessed(ctx context.Context, localVarOptionals *RepositoryApiGetRepositoriesRecentlyAccessedOpts) (InlineResponse20029, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20029 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/profile/recent/repos" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Permission.IsSet() { + localVarQueryParams.Add("permission", parameterToString(localVarOptionals.Permission.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20029 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get repository hook +Retrieve a repository hook for this repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The hook key. + * @param repositorySlug The repository slug. +@return RestRepositoryHook +*/ +func (a *RepositoryApiService) GetRepositoryHook1(ctx context.Context, projectKey string, hookKey string, repositorySlug string) (RestRepositoryHook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryHook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryHook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get repository hooks +Retrieve a page of repository hooks for this repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetRepositoryHooks1Opts - Optional Parameters: + * @param "Type_" (optional.String) - The optional type to filter by. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20044 +*/ + +type RepositoryApiGetRepositoryHooks1Opts struct { + Type_ optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetRepositoryHooks1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetRepositoryHooks1Opts) (InlineResponse20044, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20044 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks" + 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 localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20044 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get a ref restriction +Returns a restriction as specified by a restriction id. The authenticated user must have <strong>REPO_ADMIN</strong> permission or higher to call this resource. Only authenticated users may call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The restriction id. + * @param repositorySlug The repository slug. +@return RestRefRestriction +*/ +func (a *RepositoryApiService) GetRestriction1(ctx context.Context, projectKey string, id string, repositorySlug string) (RestRefRestriction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRefRestriction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRefRestriction + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Search for ref restrictions +Search for restrictions using the supplied parameters. The authenticated user must have <strong>REPO_ADMIN</strong> permission or higher to call this resource. Only authenticated users may call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetRestrictions1Opts - Optional Parameters: + * @param "MatcherType" (optional.String) - Matcher type to filter on + * @param "MatcherId" (optional.String) - Matcher id to filter on. Requires the matcherType parameter to be specified also. + * @param "Type_" (optional.String) - Types of restrictions to filter on. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20013 +*/ + +type RepositoryApiGetRestrictions1Opts struct { + MatcherType optional.String + MatcherId optional.String + Type_ optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetRestrictions1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetRestrictions1Opts) (InlineResponse20013, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20013 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/branch-permissions/latest/projects/{projectKey}/repos/{repositorySlug}/restrictions" + 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 localVarOptionals != nil && localVarOptionals.MatcherType.IsSet() { + localVarQueryParams.Add("matcherType", parameterToString(localVarOptionals.MatcherType.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.MatcherId.IsSet() { + localVarQueryParams.Add("matcherId", parameterToString(localVarOptionals.MatcherId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20013 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get repository hook settings +Retrieve the settings for a repository hook for this repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The hook key. + * @param repositorySlug The repository slug. +@return ExampleSettings +*/ +func (a *RepositoryApiService) GetSettings1(ctx context.Context, projectKey string, hookKey string, repositorySlug string) (ExampleSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExampleSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ExampleSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get synchronization status +Retrieves the synchronization status for the specified repository. In addition to listing refs which cannot be synchronized, if any, the status also provides the timestamp for the most recent synchronization and indicates whether synchronization is available and enabled. If \"?at\" is specified in the URL, the synchronization status for the specified ref is returned, rather than the complete repository status. The authenticated user must have <b>REPO_READ</b> permission for the repository, or it must be public if the request is anonymous. Additionally, after synchronization is enabled for a repository, meaning synchronization was available at that time, permission changes and other actions can cause it to become unavailable. Even when synchronization is enabled, if it is no longer available for the repository it will not be performed. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetStatusOpts - Optional Parameters: + * @param "At" (optional.String) - Retrieves the synchronization status for the specified ref within the repository, rather than for the entire repository +@return RestRefSyncStatus +*/ + +type RepositoryApiGetStatusOpts struct { + At optional.String +} + +func (a *RepositoryApiService) GetStatus(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetStatusOpts) (RestRefSyncStatus, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRefSyncStatus + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/sync/latest/projects/{projectKey}/repos/{repositorySlug}" + 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 localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRefSyncStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get tag +Retrieve a tag in the specified repository. The authenticated user must have <strong>REPO_READ</strong> permission for the context repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param name The name of the tag to be retrieved. + * @param repositorySlug The repository slug. +@return RestTag +*/ +func (a *RepositoryApiService) GetTag(ctx context.Context, projectKey string, name string, repositorySlug string) (RestTag, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestTag + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestTag + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Find tag +Retrieve the tags matching the supplied <strong>filterText</strong> param. The authenticated user must have <strong>REPO_READ</strong> permission for the context repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetTagsOpts - Optional Parameters: + * @param "OrderBy" (optional.String) - Ordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated) + * @param "FilterText" (optional.String) - The text to match on. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20046 +*/ + +type RepositoryApiGetTagsOpts struct { + OrderBy optional.String + FilterText optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) GetTags(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiGetTagsOpts) (InlineResponse20046, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20046 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/tags" + 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 localVarOptionals != nil && localVarOptionals.OrderBy.IsSet() { + localVarQueryParams.Add("orderBy", parameterToString(localVarOptionals.OrderBy.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.FilterText.IsSet() { + localVarQueryParams.Add("filterText", parameterToString(localVarOptionals.FilterText.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20046 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get webhook +Get a webhook by ID. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param webhookId ID of the webhook + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiGetWebhook1Opts - Optional Parameters: + * @param "Statistics" (optional.String) - <code>true</code> if statistics should be provided for the webhook +@return RestWebhook +*/ + +type RepositoryApiGetWebhook1Opts struct { + Statistics optional.String +} + +func (a *RepositoryApiService) GetWebhook1(ctx context.Context, projectKey string, webhookId string, repositorySlug string, localVarOptionals *RepositoryApiGetWebhook1Opts) (RestWebhook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestWebhook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"webhookId"+"}", fmt.Sprintf("%v", webhookId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Statistics.IsSet() { + localVarQueryParams.Add("statistics", parameterToString(localVarOptionals.Statistics.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestWebhook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService React to a comment +Add an emoticon reaction to a comment + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The comment id + * @param commitId The commit id + * @param emoticon The emoticon to add + * @param repositorySlug The repository slug. +@return RestUserReaction +*/ +func (a *RepositoryApiService) React(ctx context.Context, projectKey string, commentId string, commitId string, emoticon string, repositorySlug string) (RestUserReaction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestUserReaction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"emoticon"+"}", fmt.Sprintf("%v", emoticon), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestUserReaction + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Remove a hook script +Removes the hook script from the set of hook scripts configured to run in the repository. This endpoint requires **REPO_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param scriptId The ID of the hook script + * @param repositorySlug The repository slug. + +*/ +func (a *RepositoryApiService) RemoveConfiguration1(ctx context.Context, projectKey string, scriptId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"scriptId"+"}", fmt.Sprintf("%v", scriptId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Remove repository label +Remove label that is applied to the given repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param labelName The label to remove + * @param repositorySlug The repository slug. + +*/ +func (a *RepositoryApiService) RemoveLabel(ctx context.Context, projectKey string, labelName string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/labels/{labelName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"labelName"+"}", fmt.Sprintf("%v", labelName), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Save attachment metadata +Save attachment metadata. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository that is associated to the attachment that has the attachment metadata. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param attachmentId the attachment ID + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiSaveAttachmentMetadataOpts - Optional Parameters: + * @param "Body" (optional.Interface of string) - The attachment metadata can be any valid JSON content + +*/ + +type RepositoryApiSaveAttachmentMetadataOpts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) SaveAttachmentMetadata(ctx context.Context, projectKey string, attachmentId string, repositorySlug string, localVarOptionals *RepositoryApiSaveAttachmentMetadataOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/attachments/{attachmentId}/metadata" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"attachmentId"+"}", fmt.Sprintf("%v", attachmentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Search webhooks +Search webhooks in this repository and parent project. This endpoint returns a superset of the results returned by the /webhooks endpoint because it allows filtering by project scope too, not just repository webhooks. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiSearchWebhooksOpts - Optional Parameters: + * @param "ScopeType" (optional.String) - Scopes to filter by. This parameter can be specified once e.g. \"scopeType=repository\", or twice e.g. \"scopeType=repository&scopeType=project\", to filter by more than one scope level. + * @param "Event" (optional.String) - List of <code>com.atlassian.webhooks.WebhookEvent</code> ids to filter for + * @param "Statistics" (optional.Bool) - <code>true</code> if statistics should be provided for all found webhooks + +*/ + +type RepositoryApiSearchWebhooksOpts struct { + ScopeType optional.String + Event optional.String + Statistics optional.Bool +} + +func (a *RepositoryApiService) SearchWebhooks(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiSearchWebhooksOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/search" + 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 localVarOptionals != nil && localVarOptionals.ScopeType.IsSet() { + localVarQueryParams.Add("scopeType", parameterToString(localVarOptionals.ScopeType.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Event.IsSet() { + localVarQueryParams.Add("event", parameterToString(localVarOptionals.Event.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Statistics.IsSet() { + localVarQueryParams.Add("statistics", parameterToString(localVarOptionals.Statistics.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Create auto decline settings +Creates or updates the auto decline settings for the supplied repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for this repository to call the resource + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiSetAutoDeclineSettings1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestAutoDeclineSettingsRequest) - The settings to create or update +@return RestAutoDeclineSettings +*/ + +type RepositoryApiSetAutoDeclineSettings1Opts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) SetAutoDeclineSettings1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiSetAutoDeclineSettings1Opts) (RestAutoDeclineSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAutoDeclineSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/auto-decline" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAutoDeclineSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Create/update a hook script +Creates/updates the hook script configuration for the provided hook script and repository. This endpoint requires **REPO_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param scriptId The ID of the hook script + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiSetConfiguration1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestHookScriptTriggers) - The hook triggers for which the hook script should be run +@return RestHookScriptConfig +*/ + +type RepositoryApiSetConfiguration1Opts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) SetConfiguration1(ctx context.Context, projectKey string, scriptId string, repositorySlug string, localVarOptionals *RepositoryApiSetConfiguration1Opts) (RestHookScriptConfig, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestHookScriptConfig + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/hook-scripts/{scriptId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"scriptId"+"}", fmt.Sprintf("%v", scriptId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestHookScriptConfig + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Update default branch +Update the default branch of a repository. This URL is deprecated. Callers should use <code>PUT /projects/{key}/repos/{slug}/default-branch</code> instead. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiSetDefaultBranch1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestBranch) - The branch to set as default + +*/ + +type RepositoryApiSetDefaultBranch1Opts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) SetDefaultBranch1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiSetDefaultBranch1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/branches/default" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Disable synchronization +Enables or disables synchronization for the specified repository. When synchronization is enabled, branches within the repository are immediately synchronized and the status is updated with the outcome. That initial synchronization is performed before the REST request returns, allowing it to return the updated status. The authenticated user must have <b>REPO_ADMIN</b> permission for the specified repository. Anonymous users cannot manage synchronization, even on public repositories. Additionally, synchronization must be available for the specified repository. Synchronization is only available if: - The repository is a fork, since its origin is used as upstream - The owning user still has access to the fork's origin, if the repository is a <i>personalfork</i> + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiSetEnabledOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestRefSyncStatus) - +@return RestRefSyncStatus +*/ + +type RepositoryApiSetEnabledOpts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) SetEnabled(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiSetEnabledOpts) (RestRefSyncStatus, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRefSyncStatus + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/sync/latest/projects/{projectKey}/repos/{repositorySlug}" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRefSyncStatus + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Update repository hook settings +Modify the settings for a repository hook for this repository. The service will reject any settings which are too large, the current limit is 32KB once serialized. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. A JSON document can be provided to use as the settings for the hook. These structure and validity of the document is decided by the plugin providing the hook. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param hookKey The hook key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiSetSettings1Opts - Optional Parameters: + * @param "Body" (optional.Interface of ExampleSettings) - The raw settings. +@return ExampleSettings +*/ + +type RepositoryApiSetSettings1Opts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) SetSettings1(ctx context.Context, projectKey string, hookKey string, repositorySlug string, localVarOptionals *RepositoryApiSetSettings1Opts) (ExampleSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExampleSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/settings" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hookKey"+"}", fmt.Sprintf("%v", hookKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ExampleSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Stream files +Streams files from the repository's root with the last commit to modify each file. Commit modifications are traversed starting from the <code>at</code> commit or, if not specified, from the tip of the default branch. Unless the repository is public, the authenticated user must have <b>REPO_READ</b> access to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiStreamOpts - Optional Parameters: + * @param "At" (optional.String) - The commit to use as the starting point when listing files and calculating modifications +@return ExampleFiles +*/ + +type RepositoryApiStreamOpts struct { + At optional.String +} + +func (a *RepositoryApiService) Stream(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStreamOpts) (ExampleFiles, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExampleFiles + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified" + 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 localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ExampleFiles + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Stream files with last modified commit in path +Streams files in the requested <code>path</code> with the last commit to modify each file. Commit modifications are traversed starting from the <code>at</code> commit or, if not specified, from the tip of the default branch. Unless the repository is public, the authenticated user must have <b>REPO_READ</b> access to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param path The path within the repository whose files should be streamed + * @param projectKey The project key + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiStream1Opts - Optional Parameters: + * @param "At" (optional.String) - The commit to use as the starting point when listing files and calculating modifications +@return ExampleFiles +*/ + +type RepositoryApiStream1Opts struct { + At optional.String +} + +func (a *RepositoryApiService) Stream1(ctx context.Context, path string, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStream1Opts) (ExampleFiles, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExampleFiles + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/last-modified/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + 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 localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ExampleFiles + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Compare commits +Gets the file changes available in the <code> from</code> commit but not in the <code> to</code> commit. If either the <code> from</code> or <code> to</code> commit are not specified, they will be replaced by the default branch of their containing repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiStreamChangesOpts - Optional Parameters: + * @param "FromRepo" (optional.String) - an optional parameter specifying the source repository containing the source commit if that commit is not present in the current repository; the repository can be specified by either its ID <em>fromRepo=42</em> or by its project key plus its repo slug separated by a slash: <em>fromRepo=projectKey/repoSlug</em> + * @param "From" (optional.String) - the source commit (can be a partial/full commit ID or qualified/unqualified ref name) + * @param "To" (optional.String) - the target commit (can be a partial/full commit ID or qualified/unqualified ref name) + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20034 +*/ + +type RepositoryApiStreamChangesOpts struct { + FromRepo optional.String + From optional.String + To optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) StreamChanges(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStreamChangesOpts) (InlineResponse20034, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20034 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/changes" + 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 localVarOptionals != nil && localVarOptionals.FromRepo.IsSet() { + localVarQueryParams.Add("fromRepo", parameterToString(localVarOptionals.FromRepo.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.From.IsSet() { + localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.To.IsSet() { + localVarQueryParams.Add("to", parameterToString(localVarOptionals.To.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20034 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get accessible commits +Gets the commits accessible from the <code>from</code> commit but not in the <code>to</code> commit. If either the <code>from</code> or <code>to</code> commit are not specified, they will be replaced by the default branch of their containing repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiStreamCommitsOpts - Optional Parameters: + * @param "FromRepo" (optional.String) - an optional parameter specifying the source repository containing the source commit if that commit is not present in the current repository; the repository can be specified by either its ID <em>fromRepo=42</em> or by its project key plus its repo slug separated by a slash: <em>fromRepo=projectKey/repoSlug</em> + * @param "From" (optional.String) - the source commit (can be a partial/full commit ID or qualified/unqualified ref name) + * @param "To" (optional.String) - the target commit (can be a partial/full commit ID or qualified/unqualified ref name) + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20035 +*/ + +type RepositoryApiStreamCommitsOpts struct { + FromRepo optional.String + From optional.String + To optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) StreamCommits(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStreamCommitsOpts) (InlineResponse20035, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20035 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/commits" + 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 localVarOptionals != nil && localVarOptionals.FromRepo.IsSet() { + localVarQueryParams.Add("fromRepo", parameterToString(localVarOptionals.FromRepo.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.From.IsSet() { + localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.To.IsSet() { + localVarQueryParams.Add("to", parameterToString(localVarOptionals.To.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20035 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get diff between revisions +Retrieve the diff between two provided revisions. To stream a raw text representation of the diff, this endpoint can be called with the request header 'Accept: text/plain'. Note:</strong> This resource is currently <i>not paged</i>. The server will internally apply a hard cap to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded. In the event that the cap is reached, the diff will be cut short and one or more {@code truncated} flags will be set to true on the \"segments\", \"hunks\" and \"diffs\" properties, as well as the top-level object, in the returned JSON response. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param commitId The <i>full ID</i> of the commit within the repository + * @param repositorySlug The repository slug + * @param path The path to the file which should be diffed (optional) + * @param projectKey The project key + * @param optional nil or *RepositoryApiStreamDiffOpts - Optional Parameters: + * @param "SrcPath" (optional.String) - The source path for the file, if it was copied, moved or renamed + * @param "AvatarSize" (optional.String) - If present the service adds avatar URLs for comment authors where the provided value specifies the desired avatar size in pixels. Not applicable if streaming raw diff + * @param "Filter" (optional.String) - Text used to filter files and lines (optional). Not applicable if streaming raw diff + * @param "AvatarScheme" (optional.String) - The security scheme for avatar URLs. If the scheme is not present then it is inherited from the request. It can be set to \"https\" to force the use of secure URLs. Not applicable if streaming raw diff + * @param "ContextLines" (optional.String) - The number of context lines to include around added/removed lines in the diff.Not applicable if streaming raw diff + * @param "AutoSrcPath" (optional.String) - <code>true</code> to automatically try to find the source path when it's not provided, <code>false</code> otherwise. Requires the path to be provided. + * @param "Whitespace" (optional.String) - Optional whitespace flag which can be set to ignore-all + * @param "WithComments" (optional.String) - <code>true</code> to embed comments in the diff (the default); otherwise <code>false</code> to stream the diff without comments. Not applicable if streaming raw diff + * @param "Since" (optional.String) - The base revision to diff from. If omitted the parent revision of the until revision is used +@return RestDiff +*/ + +type RepositoryApiStreamDiffOpts struct { + SrcPath optional.String + AvatarSize optional.String + Filter optional.String + AvatarScheme optional.String + ContextLines optional.String + AutoSrcPath optional.String + Whitespace optional.String + WithComments optional.String + Since optional.String +} + +func (a *RepositoryApiService) StreamDiff(ctx context.Context, commitId string, repositorySlug string, path string, projectKey string, localVarOptionals *RepositoryApiStreamDiffOpts) (RestDiff, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestDiff + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/diff/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.SrcPath.IsSet() { + localVarQueryParams.Add("srcPath", parameterToString(localVarOptionals.SrcPath.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AvatarSize.IsSet() { + localVarQueryParams.Add("avatarSize", parameterToString(localVarOptionals.AvatarSize.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AvatarScheme.IsSet() { + localVarQueryParams.Add("avatarScheme", parameterToString(localVarOptionals.AvatarScheme.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ContextLines.IsSet() { + localVarQueryParams.Add("contextLines", parameterToString(localVarOptionals.ContextLines.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AutoSrcPath.IsSet() { + localVarQueryParams.Add("autoSrcPath", parameterToString(localVarOptionals.AutoSrcPath.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Whitespace.IsSet() { + localVarQueryParams.Add("whitespace", parameterToString(localVarOptionals.Whitespace.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.WithComments.IsSet() { + localVarQueryParams.Add("withComments", parameterToString(localVarOptionals.WithComments.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Since.IsSet() { + localVarQueryParams.Add("since", parameterToString(localVarOptionals.Since.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestDiff + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get diff between commits +Gets a diff of the changes available in the <code>from</code> commit but not in the <code> to</code> commit. If either the <code> from</code> or <code> to</code> commit are not specified, they will be replaced by the default branch of their containing repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param path the path to the file to diff (optional) + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiStreamDiff1Opts - Optional Parameters: + * @param "ContextLines" (optional.String) - an optional number of context lines to include around each added or removed lines in the diff + * @param "FromRepo" (optional.String) - an optional parameter specifying the source repository containing the source commit if that commit is not present in the current repository; the repository can be specified by either its ID <em>fromRepo=42</em> or by its project key plus its repo slug separated by a slash: <em>fromRepo=projectKey/repoSlug</em> + * @param "SrcPath" (optional.String) - source path + * @param "From" (optional.String) - the source commit (can be a partial/full commit ID or qualified/unqualified ref name) + * @param "To" (optional.String) - the target commit (can be a partial/full commit ID or qualified/unqualified ref name) + * @param "Whitespace" (optional.String) - an optional whitespace flag which can be set to <code>ignore-all</code> + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20037 +*/ + +type RepositoryApiStreamDiff1Opts struct { + ContextLines optional.String + FromRepo optional.String + SrcPath optional.String + From optional.String + To optional.String + Whitespace optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) StreamDiff1(ctx context.Context, path string, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStreamDiff1Opts) (InlineResponse20037, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20037 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/compare/diff{path}" + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + 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 localVarOptionals != nil && localVarOptionals.ContextLines.IsSet() { + localVarQueryParams.Add("contextLines", parameterToString(localVarOptionals.ContextLines.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.FromRepo.IsSet() { + localVarQueryParams.Add("fromRepo", parameterToString(localVarOptionals.FromRepo.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SrcPath.IsSet() { + localVarQueryParams.Add("srcPath", parameterToString(localVarOptionals.SrcPath.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.From.IsSet() { + localVarQueryParams.Add("from", parameterToString(localVarOptionals.From.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.To.IsSet() { + localVarQueryParams.Add("to", parameterToString(localVarOptionals.To.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Whitespace.IsSet() { + localVarQueryParams.Add("whitespace", parameterToString(localVarOptionals.Whitespace.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20037 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get files in directory +Retrieve a page of files from particular directory of a repository. The search is done recursively, so all files from any sub-directory of the specified directory will be returned. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param path The directory to list files for. + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiStreamFilesOpts - Optional Parameters: + * @param "At" (optional.String) - The commit ID or ref (e.g. a branch or tag) to list the files at. If not specified the default branch will be used instead. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20038 +*/ + +type RepositoryApiStreamFilesOpts struct { + At optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) StreamFiles(ctx context.Context, path string, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStreamFilesOpts) (InlineResponse20038, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20038 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/files/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + 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 localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20038 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get files in directory +Retrieve a page of files from particular directory of a repository. The search is done recursively, so all files from any sub-directory of the specified directory will be returned. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiStreamFiles1Opts - Optional Parameters: + * @param "At" (optional.String) - The commit ID or ref (e.g. a branch or tag) to list the files at. If not specified the default branch will be used instead. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20038 +*/ + +type RepositoryApiStreamFiles1Opts struct { + At optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *RepositoryApiService) StreamFiles1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStreamFiles1Opts) (InlineResponse20038, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20038 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/files" + 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 localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20038 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Get patch content at revision +Retrieve the patch content for a repository at a specified revision. Cache headers are added to the response (only if full commit hashes are used, not in the case of short hashes). The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiStreamPatchOpts - Optional Parameters: + * @param "Until" (optional.String) - The target revision from which to generate the patch (required) + * @param "AllAncestors" (optional.String) - indicates whether or not to generate a patch which includes all the ancestors of the 'until' revision. If true, the value provided by 'since' is ignored. + * @param "Since" (optional.String) - The base revision from which to generate the patch. This is only applicable when 'allAncestors' is false. If omitted the patch will represent one single commit, the 'until'. + +*/ + +type RepositoryApiStreamPatchOpts struct { + Until optional.String + AllAncestors optional.String + Since optional.String +} + +func (a *RepositoryApiService) StreamPatch(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStreamPatchOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/patch" + 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 localVarOptionals != nil && localVarOptionals.Until.IsSet() { + localVarQueryParams.Add("until", parameterToString(localVarOptionals.Until.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.AllAncestors.IsSet() { + localVarQueryParams.Add("allAncestors", parameterToString(localVarOptionals.AllAncestors.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Since.IsSet() { + localVarQueryParams.Add("since", parameterToString(localVarOptionals.Since.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Get raw content of a file at revision +Retrieve the raw content for a file path at a specified revision. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param path The file path to retrieve content from + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiStreamRawOpts - Optional Parameters: + * @param "At" (optional.String) - A specific commit or ref to retrieve the raw content at, or the default branch if not specified + * @param "Markup" (optional.String) - If present or \"true\", triggers the raw content to be markup-rendered and returned as HTML; otherwise, if not specified, or any value other than \"true\", the content is streamed without markup + * @param "HtmlEscape" (optional.String) - (Optional) true if HTML should be escaped in the input markup, false otherwise. If not specified, the value of the markup.render.html.escape property, which is true by default, will be used + * @param "IncludeHeadingId" (optional.String) - (Optional) true if headings should contain an ID based on the heading content. If not specified, the value of the markup.render.headerids property, which is false by default, will be used + * @param "Hardwrap" (optional.String) - (Optional) Whether the markup implementation should convert newlines to breaks. If not specified, the value of the markup.render.hardwrap property, which is true by default, will be used + +*/ + +type RepositoryApiStreamRawOpts struct { + At optional.String + Markup optional.String + HtmlEscape optional.String + IncludeHeadingId optional.String + Hardwrap optional.String +} + +func (a *RepositoryApiService) StreamRaw(ctx context.Context, path string, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStreamRawOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/raw/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + 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 localVarOptionals != nil && localVarOptionals.At.IsSet() { + localVarQueryParams.Add("at", parameterToString(localVarOptionals.At.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Markup.IsSet() { + localVarQueryParams.Add("markup", parameterToString(localVarOptionals.Markup.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.HtmlEscape.IsSet() { + localVarQueryParams.Add("htmlEscape", parameterToString(localVarOptionals.HtmlEscape.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.IncludeHeadingId.IsSet() { + localVarQueryParams.Add("includeHeadingId", parameterToString(localVarOptionals.IncludeHeadingId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Hardwrap.IsSet() { + localVarQueryParams.Add("hardwrap", parameterToString(localVarOptionals.Hardwrap.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Get raw diff for path +Stream the raw diff between two provided revisions. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiStreamRawDiffOpts - Optional Parameters: + * @param "ContextLines" (optional.String) - The number of context lines to include around added/removed lines in the diff + * @param "SrcPath" (optional.String) - The source path for the file, if it was copied, moved or renamed + * @param "Until" (optional.String) - The target revision to diff to (required) + * @param "Whitespace" (optional.String) - Optional whitespace flag which can be set to <code>ignore-all</code> + * @param "Since" (optional.String) - The base revision to diff from. If omitted the parent revision of the until revision is used + +*/ + +type RepositoryApiStreamRawDiffOpts struct { + ContextLines optional.String + SrcPath optional.String + Until optional.String + Whitespace optional.String + Since optional.String +} + +func (a *RepositoryApiService) StreamRawDiff(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStreamRawDiffOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff" + 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 localVarOptionals != nil && localVarOptionals.ContextLines.IsSet() { + localVarQueryParams.Add("contextLines", parameterToString(localVarOptionals.ContextLines.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SrcPath.IsSet() { + localVarQueryParams.Add("srcPath", parameterToString(localVarOptionals.SrcPath.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Until.IsSet() { + localVarQueryParams.Add("until", parameterToString(localVarOptionals.Until.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Whitespace.IsSet() { + localVarQueryParams.Add("whitespace", parameterToString(localVarOptionals.Whitespace.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Since.IsSet() { + localVarQueryParams.Add("since", parameterToString(localVarOptionals.Since.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Get raw diff for path +Stream the raw diff between two provided revisions. The authenticated user must have <strong>REPO_READ</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param path The path to the file which should be diffed (required) + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiStreamRawDiff1Opts - Optional Parameters: + * @param "ContextLines" (optional.String) - The number of context lines to include around added/removed lines in the diff + * @param "SrcPath" (optional.String) - The source path for the file, if it was copied, moved or renamed + * @param "Until" (optional.String) - The target revision to diff to (required) + * @param "Whitespace" (optional.String) - Optional whitespace flag which can be set to <code>ignore-all</code> + * @param "Since" (optional.String) - The base revision to diff from. If omitted the parent revision of the until revision is used + +*/ + +type RepositoryApiStreamRawDiff1Opts struct { + ContextLines optional.String + SrcPath optional.String + Until optional.String + Whitespace optional.String + Since optional.String +} + +func (a *RepositoryApiService) StreamRawDiff1(ctx context.Context, path string, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiStreamRawDiff1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/diff/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + 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 localVarOptionals != nil && localVarOptionals.ContextLines.IsSet() { + localVarQueryParams.Add("contextLines", parameterToString(localVarOptionals.ContextLines.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.SrcPath.IsSet() { + localVarQueryParams.Add("srcPath", parameterToString(localVarOptionals.SrcPath.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Until.IsSet() { + localVarQueryParams.Add("until", parameterToString(localVarOptionals.Until.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Whitespace.IsSet() { + localVarQueryParams.Add("whitespace", parameterToString(localVarOptionals.Whitespace.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Since.IsSet() { + localVarQueryParams.Add("since", parameterToString(localVarOptionals.Since.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Manual synchronization +Allows developers to apply a manual operation to bring a ref back in sync with upstream when it becomes out of sync due to conflicting changes. The following actions are supported: - <tt>MERGE</tt>: Merges in commits from the upstream ref. After applying this action, the synchronized ref will be <tt>AHEAD</tt> (as it still includes commits that do not exist upstream. - This action is only supported for <tt>DIVERGED</tt> refs - If a \"commitMessage\" is provided in the context, it will be used on the merge commit. Otherwise a default message is used. - <tt>DISCARD</tt>: <i>Throws away</i> local changes in favour of those made upstream. This is a <i>destructive</i> operation where commits in the local repository are lost. - No context entries are supported for this action - If the upstream ref has been deleted, the local ref is deleted as well - Otherwise, the local ref is updated to reference the same commit as upstream, even if the update is not fast-forward (similar to a forced push) The authenticated user must have <b>REPO_WRITE</b> permission for the specified repository. Anonymous users cannot synchronize refs, even on public repositories. Additionally, synchronization must be <i>enabled</i> and <i>available</i> for the specified repository. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiSynchronizeOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestRefSyncRequest) - +@return RestRejectedRef +*/ + +type RepositoryApiSynchronizeOpts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) Synchronize(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiSynchronizeOpts) (RestRejectedRef, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRejectedRef + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/sync/latest/projects/{projectKey}/repos/{repositorySlug}/synchronize" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRejectedRef + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 501 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Remove a reaction from comment +Remove an emoticon reaction from a comment + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param commentId The comment id + * @param commitId The commit id + * @param emoticon The emoticon to remove + * @param repositorySlug The repository slug. + +*/ +func (a *RepositoryApiService) UnReact(ctx context.Context, projectKey string, commentId string, commitId string, emoticon string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/comment-likes/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}/reactions/{emoticon}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"emoticon"+"}", fmt.Sprintf("%v", emoticon), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Stop watching commit +Remove the authenticated user as a watcher for the specified commit. The authenticated user must have <strong>REPO_READ</strong> permission for the repository containing the commit to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commitId The <i>full ID</i> of the commit within the repository + * @param repositorySlug The repository slug + +*/ +func (a *RepositoryApiService) Unwatch(ctx context.Context, projectKey string, commitId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Stop watching repository +Remove the authenticated user as a watcher for the specified repository. The authenticated user must have <strong>REPO_READ</strong> permission for the repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + +*/ +func (a *RepositoryApiService) Unwatch2(ctx context.Context, projectKey string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/watch" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Update a commit comment +Update a comment, with the following restrictions: - only the author of the comment may update the <i>text</i> of the comment - only the author of the comment or repository admins and above may update the other fields of a comment <strong>Note:</strong> the supplied supplied JSON object must contain a <code>version</code> that must match the server's version of the comment or the update will fail. To determine the current version of the comment, the comment should be fetched from the server prior to the update. Look for the 'version' attribute in the returned JSON structure. The authenticated user must have <strong>REPO_READ</strong> permission for the repository that the commit is in to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commentId The ID of the comment to retrieve + * @param commitId The <i>full ID</i> of the commit within the repository + * @param repositorySlug The repository slug + * @param optional nil or *RepositoryApiUpdateCommentOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestComment) - The comment to update +@return RestComment +*/ + +type RepositoryApiUpdateCommentOpts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) UpdateComment(ctx context.Context, projectKey string, commentId string, commitId string, repositorySlug string, localVarOptionals *RepositoryApiUpdateCommentOpts) (RestComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments/{commentId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commentId"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestComment + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Update pull request settings +Update the pull request settings for the context repository. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the context repository to call this resource. This resource will call all RestFragments that are registered with the key <strong>bitbucket.repository.settings.pullRequests</strong>. If any fragment fails validations by returning a non-empty Map of errors, then no fragments will execute. Only the settings that should be updated need to be included in the request. The property keys for the settings that are bundled with the application are - mergeConfig - the merge strategy configuration for pull requests - requiredApprovers - (Deprecated, please use com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook instead) the number of approvals required on a pull request for it to be mergeable, or 0 to disable the merge check - com.atlassian.bitbucket.server.bundled-hooks.requiredApproversMergeHook - a json map containing the keys 'enabled' (a boolean to enable or disable this merge check) and 'count' (an integer to set the number of required approvals) - requiredAllApprovers - whether or not all approvers must approve a pull request for it to be mergeable - requiredAllTasksComplete - whether or not all tasks on a pull request need to be completed for it to be mergeable - requiredSuccessfulBuilds - (Deprecated, please use com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck instead) the number of successful builds on a pull request for it to be mergeable, or 0 to disable the merge check - com.atlassian.bitbucket.server.bitbucket-build.requiredBuildsMergeCheck - a json map containing the keys 'enabled' (a boolean to enable or disable this merge check) and 'count' (an integer to set the number of required builds) <strong>Merge strategy configuration deletion:</strong> An explicitly set pull request merge strategy configuration can be deleted by POSTing a document with an empty \"mergeConfig\" attribute. i.e: ```{ \"mergeConfig\": { } } ``` Upon completion of this request, the effective configuration will be: - The configuration set for this repository's SCM type as set at the project level, if present, otherwise - the configuration set for this repository's SCM type as set at the instance level, if present, otherwise - the default configuration for this repository's SCM type + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiUpdatePullRequestSettings1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestRepositoryPullRequestSettings) - The updated settings. +@return RestRepositoryPullRequestSettings +*/ + +type RepositoryApiUpdatePullRequestSettings1Opts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) UpdatePullRequestSettings1(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiUpdatePullRequestSettings1Opts) (RestRepositoryPullRequestSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryPullRequestSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/settings/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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryPullRequestSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Update webhook +Update an existing webhook. The authenticated user must have <strong>REPO_ADMIN</strong> permission for the specified repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param webhookId Id of the existing webhook + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiUpdateWebhook1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestWebhook) - The representation of the updated values for the webhook +@return RestWebhook +*/ + +type RepositoryApiUpdateWebhook1Opts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) UpdateWebhook1(ctx context.Context, projectKey string, webhookId string, repositorySlug string, localVarOptionals *RepositoryApiUpdateWebhook1Opts) (RestWebhook, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestWebhook + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/webhooks/{webhookId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"webhookId"+"}", fmt.Sprintf("%v", webhookId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestWebhook + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +RepositoryApiService Watch commit +Add the authenticated user as a watcher for the specified commit. The authenticated user must have <strong>REPO_READ</strong> permission for the repository containing the commit to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key + * @param commitId The <i>full ID</i> of the commit within the repository + * @param repositorySlug The repository slug + +*/ +func (a *RepositoryApiService) Watch(ctx context.Context, projectKey string, commitId string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/watch" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +RepositoryApiService Watch repository +Add the authenticated user as a watcher for the specified repository. The authenticated user must have <strong>REPO_READ</strong> permission for the repository to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *RepositoryApiWatch2Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestRepository) - The repository to watch. + +*/ + +type RepositoryApiWatch2Opts struct { + Body optional.Interface +} + +func (a *RepositoryApiService) Watch2(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *RepositoryApiWatch2Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/watch" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_security.go b/vendor/github.com/gdasson/bitbucketv1go/api_security.go new file mode 100644 index 000000000..255e50917 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_security.go @@ -0,0 +1,3332 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" +) + +// Linger please +var ( + _ context.Context +) + +type SecurityApiService service +/* +SecurityApiService Create a GPG key +Add a GPG key to the authenticated user's account. Optionally, users with ADMIN and higher permissions may choose to specify the <code>user</code> parameter to add a GPG key for another user. Only authenticated users may call this endpoint. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SecurityApiAddKeyOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestGpgKey) - The request body. + * @param "User" (optional.String) - The name of the user to add a key for (optional; requires ADMIN permission or higher). +@return RestGpgKey +*/ + +type SecurityApiAddKeyOpts struct { + Body optional.Interface + User optional.String +} + +func (a *SecurityApiService) AddKey(ctx context.Context, localVarOptionals *SecurityApiAddKeyOpts) (RestGpgKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestGpgKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/gpg/latest/keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.User.IsSet() { + localVarQueryParams.Add("user", parameterToString(localVarOptionals.User.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestGpgKey + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Bulk exempt repos from secret scanning +Bulk exempt a list of repositories from being scanned for secrets. User must be have global **ADMIN** permissions. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SecurityApiBulkAddExemptRepositoriesOpts - Optional Parameters: + * @param "Body" (optional.Interface of []RestRepositorySelector) - + +*/ + +type SecurityApiBulkAddExemptRepositoriesOpts struct { + Body optional.Interface +} + +func (a *SecurityApiService) BulkAddExemptRepositories(ctx context.Context, localVarOptionals *SecurityApiBulkAddExemptRepositoriesOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/secret-scanning/exempt" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SecurityApiService Create project secret scanning allowlist rule +Create a new project level secret scanning allowlist rule. Project allowlist rules are used when scanning all non exempt repositories in the provided project. Project **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Allowlist rule to create, either the line regular expression or the path regular expression must be present + * @param projectKey The project key. +@return RestSecretScanningAllowlistRule +*/ +func (a *SecurityApiService) CreateAllowlistRule(ctx context.Context, body RestSecretScanningAllowlistRuleSetRequest, projectKey string) (RestSecretScanningAllowlistRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningAllowlistRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/secret-scanning/allowlist" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningAllowlistRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Create repository secret scanning allowlist rule +Create a new repository secret scanning allowlist rule. Repository allowlist rules are used when scanning the given repository. Repository **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Allowlist rule to create, either the line regular expression or the path regular expression must be present + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return RestSecretScanningAllowlistRule +*/ +func (a *SecurityApiService) CreateAllowlistRule1(ctx context.Context, body RestSecretScanningAllowlistRuleSetRequest, projectKey string, repositorySlug string) (RestSecretScanningAllowlistRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningAllowlistRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningAllowlistRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Create project secret scanning rule +Create a new project level secret scanning rule. Project rules are used when scanning all non exempt repositories in the provided project. Project **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Rule to create, either the line regular expression or the path regular expression must be present + * @param projectKey The project key. +@return RestSecretScanningRule +*/ +func (a *SecurityApiService) CreateRule(ctx context.Context, body RestSecretScanningRuleSetRequest, projectKey string) (RestSecretScanningRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/secret-scanning/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Create repository secret scanning rule +Create a new repository secret scanning rule. Repository rules are used when scanning the given repository. Repository **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Rule to create, either the line regular expression or the path regular expression must be present + * @param projectKey The project key. + * @param repositorySlug The repository slug. +@return RestSecretScanningRule +*/ +func (a *SecurityApiService) CreateRule1(ctx context.Context, body RestSecretScanningRuleSetRequest, projectKey string, repositorySlug string) (RestSecretScanningRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules" + 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{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Create global secret scanning rule +Create a new global secret scanning rule. Global rules are used when scanning all non exempt repositories. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body Rule to create, either the line regular expression or the path regular expression must be present +@return RestSecretScanningRule +*/ +func (a *SecurityApiService) CreateRule2(ctx context.Context, body RestSecretScanningRuleSetRequest) (RestSecretScanningRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/secret-scanning/rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Delete a project secret scanning allowlist rule +Delete a project secret scanning allowlist rule with the provided ID. Project **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The allowlist rule id. + +*/ +func (a *SecurityApiService) DeleteAllowlistRule(ctx context.Context, projectKey string, id string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/secret-scanning/allowlist/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SecurityApiService Delete a repository secret scanning allowlist rule +Delete a repository secret scanning allowlist rule with the provided ID. Repository **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The allowlist rule id. + * @param repositorySlug The repository slug. + +*/ +func (a *SecurityApiService) DeleteAllowlistRule1(ctx context.Context, projectKey string, id string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SecurityApiService Delete all GPG keys for user +Delete all GPG keys for a supplied user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SecurityApiDeleteForUserOpts - Optional Parameters: + * @param "User" (optional.String) - The username of the user to delete the keys for. If no username is specified, the GPG keys will be deleted for the currently authenticated user. + +*/ + +type SecurityApiDeleteForUserOpts struct { + User optional.String +} + +func (a *SecurityApiService) DeleteForUser(ctx context.Context, localVarOptionals *SecurityApiDeleteForUserOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/gpg/latest/keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.User.IsSet() { + localVarQueryParams.Add("user", parameterToString(localVarOptionals.User.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SecurityApiService Delete a GPG key +Delete the GPG key with the specified ID or Key Fingerprint. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param fingerprintOrId The GPG fingerprint or ID. + +*/ +func (a *SecurityApiService) DeleteKey(ctx context.Context, fingerprintOrId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/gpg/latest/keys/{fingerprintOrId}" + localVarPath = strings.Replace(localVarPath, "{"+"fingerprintOrId"+"}", fmt.Sprintf("%v", fingerprintOrId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SecurityApiService Delete a project secret scanning rule +Delete a project secret scanning rule with the provided ID. Project **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The rule id. + +*/ +func (a *SecurityApiService) DeleteRule(ctx context.Context, projectKey string, id string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/secret-scanning/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SecurityApiService Delete a repository secret scanning rule +Delete a repository secret scanning rule with the provided ID. Repository **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The rule id. + * @param repositorySlug The repository slug. + +*/ +func (a *SecurityApiService) DeleteRule1(ctx context.Context, projectKey string, id string, repositorySlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SecurityApiService Delete a global secret scanning rule +Delete a global secret scanning rule with the provided ID + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The rule id. + +*/ +func (a *SecurityApiService) DeleteRule2(ctx context.Context, id string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/secret-scanning/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SecurityApiService Edit an existing project secret scanning allowlist rule +Edit a project secret scanning allowlist rule. Project **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + * @param projectKey The project key. + * @param id The allowlist rule id. +@return RestSecretScanningAllowlistRule +*/ +func (a *SecurityApiService) EditAllowlistRule(ctx context.Context, body RestSecretScanningAllowlistRuleSetRequest, projectKey string, id string) (RestSecretScanningAllowlistRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningAllowlistRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/secret-scanning/allowlist/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningAllowlistRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Edit an existing repository secret scanning allowlist rule +Edit a repository secret scanning allowlist rule. Repository **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + * @param projectKey The project key. + * @param id The allowlist rule id. + * @param repositorySlug The repository slug. +@return RestSecretScanningAllowlistRule +*/ +func (a *SecurityApiService) EditAllowlistRule1(ctx context.Context, body RestSecretScanningAllowlistRuleSetRequest, projectKey string, id string, repositorySlug string) (RestSecretScanningAllowlistRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningAllowlistRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningAllowlistRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Edit an existing project secret scanning rule +Edit a project secret scanning rule. Project **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + * @param projectKey The project key. + * @param id The rule id. +@return RestSecretScanningRule +*/ +func (a *SecurityApiService) EditRule(ctx context.Context, body RestSecretScanningRuleSetRequest, projectKey string, id string) (RestSecretScanningRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/secret-scanning/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Edit an existing repository secret scanning rule +Edit a repository secret scanning rule. Repository **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + * @param projectKey The project key. + * @param id The rule id. + * @param repositorySlug The repository slug. +@return RestSecretScanningRule +*/ +func (a *SecurityApiService) EditRule1(ctx context.Context, body RestSecretScanningRuleSetRequest, projectKey string, id string, repositorySlug string) (RestSecretScanningRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Edit a global secret scanning rule. +Edit an existing global secret scanning rule + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + * @param id The rule id. +@return RestSecretScanningRule +*/ +func (a *SecurityApiService) EditRule2(ctx context.Context, body RestSecretScanningRuleSetRequest, id string) (RestSecretScanningRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/secret-scanning/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Find all repos exempt from secret scan +Find all repositories exempt from secret scanning + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SecurityApiFindExemptReposByScopeOpts - Optional Parameters: + * @param "Order" (optional.String) - Order by project name followed by repository name either ascending or descending, defaults to ascending. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20029 +*/ + +type SecurityApiFindExemptReposByScopeOpts struct { + Order optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SecurityApiService) FindExemptReposByScope(ctx context.Context, localVarOptionals *SecurityApiFindExemptReposByScopeOpts) (InlineResponse20029, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20029 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/secret-scanning/exempt" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20029 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Get a project secret scanning allowlist rule +Get a project secret scanning allowlist rule by ID. Project **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The allowlist rule id. +@return RestSecretScanningAllowlistRule +*/ +func (a *SecurityApiService) GetAllowlistRule(ctx context.Context, projectKey string, id string) (RestSecretScanningAllowlistRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningAllowlistRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/secret-scanning/allowlist/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningAllowlistRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Get a repository secret scanning allowlist rule +Get a repository secret scanning allowlist rule by ID. Repository **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The allowlist rule id. + * @param repositorySlug The repository slug. +@return RestSecretScanningAllowlistRule +*/ +func (a *SecurityApiService) GetAllowlistRule1(ctx context.Context, projectKey string, id string, repositorySlug string) (RestSecretScanningAllowlistRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningAllowlistRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningAllowlistRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Get all GPG keys +Find all the keys for the currently authenticated user. Optionally, users with ADMIN and higher permissions may choose to specify the <code>user</code> parameter to retrieve GPG keys for another user. Only authenticated users may call this endpoint. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SecurityApiGetKeysForUserOpts - Optional Parameters: + * @param "User" (optional.String) - The name of the user to get keys for (optional; requires ADMIN permission or higher). + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse2007 +*/ + +type SecurityApiGetKeysForUserOpts struct { + User optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SecurityApiService) GetKeysForUser(ctx context.Context, localVarOptionals *SecurityApiGetKeysForUserOpts) (InlineResponse2007, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2007 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/gpg/latest/keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.User.IsSet() { + localVarQueryParams.Add("user", parameterToString(localVarOptionals.User.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse2007 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Get a project secret scanning rule +Get a project secret scanning rule by ID. Project **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The rule id. +@return RestSecretScanningRule +*/ +func (a *SecurityApiService) GetRule(ctx context.Context, projectKey string, id string) (RestSecretScanningRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/secret-scanning/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Get a repository secret scanning rule +Get a repository secret scanning rule by ID. Repository **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param id The rule id. + * @param repositorySlug The repository slug. +@return RestSecretScanningRule +*/ +func (a *SecurityApiService) GetRule1(ctx context.Context, projectKey string, id string, repositorySlug string) (RestSecretScanningRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Get a global secret scanning rule +Get a global secret scanning rule by ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The rule id. +@return RestSecretScanningRule +*/ +func (a *SecurityApiService) GetRule2(ctx context.Context, id string) (RestSecretScanningRule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSecretScanningRule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/secret-scanning/rules/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSecretScanningRule + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Find project secret scanning rules +Find project secret scanning rules by filtering. Project **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *SecurityApiSearch1Opts - Optional Parameters: + * @param "Filter" (optional.String) - Filter names by the provided text + * @param "Order" (optional.String) - Order by + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20043 +*/ + +type SecurityApiSearch1Opts struct { + Filter optional.String + Order optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SecurityApiService) Search1(ctx context.Context, projectKey string, localVarOptionals *SecurityApiSearch1Opts) (InlineResponse20043, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20043 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/secret-scanning/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20043 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Find repository secret scanning allowlist rules +Find repository secret scanning allowlist rules by filtering. Repository **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *SecurityApiSearch2Opts - Optional Parameters: + * @param "Filter" (optional.String) - Filter names by the provided text + * @param "Order" (optional.String) - Order by + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20042 +*/ + +type SecurityApiSearch2Opts struct { + Filter optional.String + Order optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SecurityApiService) Search2(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *SecurityApiSearch2Opts) (InlineResponse20042, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20042 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/allowlist" + 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 localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20042 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Find repository secret scanning rules +Find repository secret scanning rules by filtering. Repository **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param repositorySlug The repository slug. + * @param optional nil or *SecurityApiSearch3Opts - Optional Parameters: + * @param "Filter" (optional.String) - Filter names by the provided text + * @param "Order" (optional.String) - Order by + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20043 +*/ + +type SecurityApiSearch3Opts struct { + Filter optional.String + Order optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SecurityApiService) Search3(ctx context.Context, projectKey string, repositorySlug string, localVarOptionals *SecurityApiSearch3Opts) (InlineResponse20043, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20043 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/repos/{repositorySlug}/secret-scanning/rules" + 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 localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20043 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Find global secret scanning rules +Find global secret scanning rules by filtering. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SecurityApiSearch4Opts - Optional Parameters: + * @param "Filter" (optional.String) - Filter by rule name + * @param "Order" (optional.String) - Order by + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20043 +*/ + +type SecurityApiSearch4Opts struct { + Filter optional.String + Order optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SecurityApiService) Search4(ctx context.Context, localVarOptionals *SecurityApiSearch4Opts) (InlineResponse20043, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20043 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/secret-scanning/rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20043 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SecurityApiService Find project secret scanning allowlist rules +Find project secret scanning allowlist rules by filtering. Project **Admin** is required + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param projectKey The project key. + * @param optional nil or *SecurityApiSearchAllowlistRuleOpts - Optional Parameters: + * @param "Filter" (optional.String) - Filter names by the provided text + * @param "Order" (optional.String) - Order by + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20042 +*/ + +type SecurityApiSearchAllowlistRuleOpts struct { + Filter optional.String + Order optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SecurityApiService) SearchAllowlistRule(ctx context.Context, projectKey string, localVarOptionals *SecurityApiSearchAllowlistRuleOpts) (InlineResponse20042, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20042 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/projects/{projectKey}/secret-scanning/allowlist" + localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20042 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/api_system_maintenance.go b/vendor/github.com/gdasson/bitbucketv1go/api_system_maintenance.go new file mode 100644 index 000000000..395909491 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/api_system_maintenance.go @@ -0,0 +1,8187 @@ + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" + "github.com/antihax/optional" + "os" +) + +// Linger please +var ( + _ context.Context +) + +type SystemMaintenanceApiService service +/* +SystemMaintenanceApiService Cancel export job +Requests the cancellation of an export job. The request to cancel a job will be processed successfully if the job is actually still running. If it has already finished (successfully or with errors) or if it has already been canceled before, then an error will be returned. There might be a small delay between accepting the request and actually cancelling the job. In most cases, the delay will be close to instantaneously. In the unlikely case of communication issues across a cluster, it can however take a few seconds to cancel a job. A client should always actively query the job status to confirm that a job has been successfully canceled. The authenticated user must have **ADMIN** permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param jobId the ID of the job to cancel + +*/ +func (a *SystemMaintenanceApiService) CancelExportJob(ctx context.Context, jobId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/exports/{jobId}/cancel" + localVarPath = strings.Replace(localVarPath, "{"+"jobId"+"}", fmt.Sprintf("%v", jobId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Cancel import job +Requests the cancellation of an import job. The request to cancel a job will be processed successfully if the job is actually still running. If it has already finished (successfully or with errors) or if it has already been canceled before, then an error will be returned. Note that import jobs are not canceled as instantaneously as export jobs. Rather, once the request has been accepted, there are a number of checkpoints at which the job will actually apply it and stop. This is to keep the system in a reasonably consistent state: - After the current fork hierarchy has been imported and verified. - Before the next repository is imported. - Before the next pull request is imported. A client should always actively query the job status to confirm that a job has been successfully canceled. The authenticated user must have **ADMIN** permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param jobId the ID of the job to cancel + +*/ +func (a *SystemMaintenanceApiService) CancelImportJob(ctx context.Context, jobId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/imports/{jobId}/cancel" + localVarPath = strings.Replace(localVarPath, "{"+"jobId"+"}", fmt.Sprintf("%v", jobId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Cancel Mesh migration job +Requests the cancellation of a migration job. The request to cancel a job will be processed successfully if the job is actually still running. If it has already finished (successfully or with errors) or if it has already been canceled before, then an error will be returned. There might be a small delay between accepting the request and actually cancelling the job. In most cases, the delay will be close to instantaneously. In the unlikely case of communication issues across a cluster, it can however take a few seconds to cancel a job. A client should always actively query the job status to confirm that a job has been successfully canceled. The authenticated user must have **SYS_ADMIN** permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param jobId The ID of the job to cancel + +*/ +func (a *SystemMaintenanceApiService) CancelMeshMigrationJob(ctx context.Context, jobId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/mesh/{jobId}/cancel" + localVarPath = strings.Replace(localVarPath, "{"+"jobId"+"}", fmt.Sprintf("%v", jobId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Clear default branch +Clears the global default branch, which is used when creating new repositories if an explicit default branch is not specified, if one has been configured. The authenticated user must have <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *SystemMaintenanceApiService) ClearDefaultBranch(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/default-branch" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update mail configuration +Clears the server email address. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *SystemMaintenanceApiService) ClearSenderAddress(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/mail-server/sender-address" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Generate Mesh connectivity report +Generates a connectivity report between the Bitbucket node(s) and the Mesh node(s). The authenticated user must have **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestMeshConnectivityReport +*/ +func (a *SystemMaintenanceApiService) Connectivity(ctx context.Context) (RestMeshConnectivityReport, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMeshConnectivityReport + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/git/mesh/diagnostics/connectivity" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMeshConnectivityReport + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Create a new hook script +Create a new hook script. This endpoint requires **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiCreateHookScriptOpts - Optional Parameters: + * @param "Content" (optional.String) - + * @param "Description" (optional.String) - + * @param "Name" (optional.String) - + * @param "Type_" (optional.String) - +@return RestHookScript +*/ + +type SystemMaintenanceApiCreateHookScriptOpts struct { + Content optional.String + Description optional.String + Name optional.String + Type_ optional.String +} + +func (a *SystemMaintenanceApiService) CreateHookScript(ctx context.Context, localVarOptionals *SystemMaintenanceApiCreateHookScriptOpts) (RestHookScript, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestHookScript + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/hook-scripts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.Content.IsSet() { + localVarFormParams.Add("content", parameterToString(localVarOptionals.Content.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Description.IsSet() { + localVarFormParams.Add("description", parameterToString(localVarOptionals.Description.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Name.IsSet() { + localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarFormParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestHookScript + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Delete Mesh node +Delete a Mesh node The authenticated user must have **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id + * @param optional nil or *SystemMaintenanceApiDelete2Opts - Optional Parameters: + * @param "Force" (optional.Bool) - + +*/ + +type SystemMaintenanceApiDelete2Opts struct { + Force optional.Bool +} + +func (a *SystemMaintenanceApiService) Delete2(ctx context.Context, id int64, localVarOptionals *SystemMaintenanceApiDelete2Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/git/mesh/nodes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Force.IsSet() { + localVarQueryParams.Add("force", parameterToString(localVarOptionals.Force.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Delete user specific rate limit settings +Deletes the user-specific rate limit settings for the given user. The authenticated user must have <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userSlug The user slug. + +*/ +func (a *SystemMaintenanceApiService) Delete6(ctx context.Context, userSlug string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/rate-limit/settings/users/{userSlug}" + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Delete user avatar +Delete the avatar associated to a user. Users are always allowed to delete their own avatar. To delete someone else's avatar the authenticated user must have global <strong>ADMIN</strong> permission, or global <strong>SYS_ADMIN</strong> permission to update a <strong>SYS_ADMIN</strong> user's avatar. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userSlug The user slug +@return RestNamedLink +*/ +func (a *SystemMaintenanceApiService) DeleteAvatar(ctx context.Context, userSlug string) (RestNamedLink, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestNamedLink + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/users/{userSlug}/avatar.png" + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestNamedLink + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Delete announcement banner +Deletes a banner, if one is present in the database. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *SystemMaintenanceApiService) DeleteBanner(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/banner" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Delete a hook script. +Deletes a registered hook script. This endpoint requires **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param scriptId The ID of the hook script to delete + +*/ +func (a *SystemMaintenanceApiService) DeleteHookScript(ctx context.Context, scriptId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/hook-scripts/{scriptId}" + localVarPath = strings.Replace(localVarPath, "{"+"scriptId"+"}", fmt.Sprintf("%v", scriptId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Delete mail configuration +Deletes the current mail configuration. The authenticated user must have the <strong>SYS_ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *SystemMaintenanceApiService) DeleteMailConfig(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/mail-server" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Dismiss retention config notification +Dismisses the retention config review notification displayed by the audit plugin for the user that's currently logged in. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *SystemMaintenanceApiService) DismissRetentionConfigReviewNotification(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/audit/latest/notification-settings/retention-config-review" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get license details +Retrieves details about the current license, as well as the current status of the system with regards to the installed license. The status includes the current number of users applied toward the license limit, as well as any status messages about the license (warnings about expiry or user counts exceeding license limits). The authenticated user must have <b>ADMIN</b> permission. Unauthenticated users, and non-administrators, are not permitted to access license details. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestBitbucketLicense +*/ +func (a *SystemMaintenanceApiService) Get2(ctx context.Context) (RestBitbucketLicense, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestBitbucketLicense + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/license" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestBitbucketLicense + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get user specific rate limit settings +Retrieves the user-specific rate limit settings for the given user. To call this resource, the user must be authenticated and either have <strong>ADMIN</strong> permission or be the same user as the one whose settings are requested. A user with <strong>ADMIN</strong> permission cannot get the settings of a user with <strong>SYS_ADMIN</strong> permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userSlug The user slug. +@return RestUserRateLimitSettings +*/ +func (a *SystemMaintenanceApiService) Get4(ctx context.Context, userSlug string) (RestUserRateLimitSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestUserRateLimitSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/rate-limit/settings/users/{userSlug}" + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestUserRateLimitSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get summary for Mesh migration job +Gets the summary, including the queue status and progress, of the currently active Mesh migration job. The authenticated user must have **SYS_ADMIN** permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestMeshMigrationSummary +*/ +func (a *SystemMaintenanceApiService) GetActiveMeshMigrationSummary(ctx context.Context) (RestMeshMigrationSummary, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMeshMigrationSummary + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/mesh/summary" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMeshMigrationSummary + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get all Mesh migration job summaries +Retrieve a page of Mesh migration job summaries. Jobs are ordered by when they were started, newest first. The authenticated user must have **SYS_ADMIN** permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiGetAllMeshMigrationSummariesOpts - Optional Parameters: + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20028 +*/ + +type SystemMaintenanceApiGetAllMeshMigrationSummariesOpts struct { + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SystemMaintenanceApiService) GetAllMeshMigrationSummaries(ctx context.Context, localVarOptionals *SystemMaintenanceApiGetAllMeshMigrationSummariesOpts) (InlineResponse20028, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20028 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/mesh/summaries" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20028 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get rate limit settings for user +Retrieves the user-specific rate limit settings for the given user. The authenticated user must have <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiGetAllRateLimitSettingsOpts - Optional Parameters: + * @param "Filter" (optional.String) - Optional filter + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20020 +*/ + +type SystemMaintenanceApiGetAllRateLimitSettingsOpts struct { + Filter optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SystemMaintenanceApiService) GetAllRateLimitSettings(ctx context.Context, localVarOptionals *SystemMaintenanceApiGetAllRateLimitSettingsOpts) (InlineResponse20020, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20020 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/rate-limit/settings/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20020 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get all registered Mesh nodes +Get all the registered Mesh nodes. The authenticated user must have **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestMeshNode +*/ +func (a *SystemMaintenanceApiService) GetAllRegisteredMeshNodes(ctx context.Context) (RestMeshNode, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMeshNode + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/git/mesh/nodes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMeshNode + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get application properties +Retrieve version information and other application properties. No authentication is required to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestApplicationProperties +*/ +func (a *SystemMaintenanceApiService) GetApplicationProperties(ctx context.Context) (RestApplicationProperties, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestApplicationProperties + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/application-properties" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestApplicationProperties + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get announcement banner +Gets the announcement banner, if one exists and is available to the user + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestAnnouncementBanner +*/ +func (a *SystemMaintenanceApiService) GetBanner(ctx context.Context) (RestAnnouncementBanner, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestAnnouncementBanner + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/banner" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestAnnouncementBanner + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get the control plane PEM +Obtain the control plane PEM. The authenticated user must have **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *SystemMaintenanceApiService) GetControlPlanePublicKey(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/git/mesh/config/control-plane.pem" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"text/plain", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v RestErrors + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get the default branch +Retrieves the configured global default branch, which is used when creating new repositories if an explicit default branch is not specified. The user must be authenticated to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *SystemMaintenanceApiService) GetDefaultBranch(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/default-branch" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get export job details +Gets the details, including the current status and progress, of the export job identified by the given ID. The authenticated user must have **ADMIN** permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param jobId the ID of the job +@return RestJob +*/ +func (a *SystemMaintenanceApiService) GetExportJob(ctx context.Context, jobId string) (RestJob, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestJob + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/exports/{jobId}" + localVarPath = strings.Replace(localVarPath, "{"+"jobId"+"}", fmt.Sprintf("%v", jobId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestJob + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get job messages +Gets the messages generated by the job. Without any filter, all messages will be returned, but the response can optionally be filtered for the following severities. The severity parameter can be repeated to include multiple severities in one response. - INFO - WARN - ERROR The authenticated user must have **ADMIN** permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param jobId The ID of the job + * @param optional nil or *SystemMaintenanceApiGetExportJobMessagesOpts - Optional Parameters: + * @param "Severity" (optional.String) - The severity to include in the results + * @param "Subject" (optional.String) - The subject + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20026 +*/ + +type SystemMaintenanceApiGetExportJobMessagesOpts struct { + Severity optional.String + Subject optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SystemMaintenanceApiService) GetExportJobMessages(ctx context.Context, jobId string, localVarOptionals *SystemMaintenanceApiGetExportJobMessagesOpts) (InlineResponse20026, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20026 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/exports/{jobId}/messages" + localVarPath = strings.Replace(localVarPath, "{"+"jobId"+"}", fmt.Sprintf("%v", jobId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Severity.IsSet() { + localVarQueryParams.Add("severity", parameterToString(localVarOptionals.Severity.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Subject.IsSet() { + localVarQueryParams.Add("subject", parameterToString(localVarOptionals.Subject.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20026 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get global SSH key settings +Gets the global settings that enforce the maximum expiry of SSH keys and restrictions on SSH key types. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestSshKeySettings +*/ +func (a *SystemMaintenanceApiService) GetGlobalSettings(ctx context.Context) (RestSshKeySettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestSshKeySettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/admin" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestSshKeySettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get rate limit history +Retrieves the recent rate limit history for the instance. The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiGetHistoryOpts - Optional Parameters: + * @param "Order" (optional.String) - An optional sort category to arrange the results in descending order + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20019 +*/ + +type SystemMaintenanceApiGetHistoryOpts struct { + Order optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SystemMaintenanceApiService) GetHistory(ctx context.Context, localVarOptionals *SystemMaintenanceApiGetHistoryOpts) (InlineResponse20019, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20019 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/rate-limit/history" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Order.IsSet() { + localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20019 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get a hook script +Retrieves a hook script by ID. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param scriptId The ID of the hook script to retrieve +@return RestHookScript +*/ +func (a *SystemMaintenanceApiService) GetHookScript(ctx context.Context, scriptId string) (RestHookScript, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestHookScript + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/hook-scripts/{scriptId}" + localVarPath = strings.Replace(localVarPath, "{"+"scriptId"+"}", fmt.Sprintf("%v", scriptId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestHookScript + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get import job status +Gets the details, including the current status and progress, of the import job identified by the given ID. The authenticated user must have **ADMIN** permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param jobId The ID of the job +@return RestJob +*/ +func (a *SystemMaintenanceApiService) GetImportJob(ctx context.Context, jobId string) (RestJob, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestJob + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/imports/{jobId}" + localVarPath = strings.Replace(localVarPath, "{"+"jobId"+"}", fmt.Sprintf("%v", jobId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestJob + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get import job messages +Gets the messages generated by the job. Without any filter, all messages will be returned, but the response can optionally be filtered for the following severities. The severity parameter can be repeated to include multiple severities in one response. - INFO - WARN - ERROR The authenticated user must have **ADMIN** permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param jobId The ID of the job + * @param optional nil or *SystemMaintenanceApiGetImportJobMessagesOpts - Optional Parameters: + * @param "Severity" (optional.String) - The severity to include in the results + * @param "Subject" (optional.String) - The subject + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20026 +*/ + +type SystemMaintenanceApiGetImportJobMessagesOpts struct { + Severity optional.String + Subject optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SystemMaintenanceApiService) GetImportJobMessages(ctx context.Context, jobId string, localVarOptionals *SystemMaintenanceApiGetImportJobMessagesOpts) (InlineResponse20026, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20026 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/imports/{jobId}/messages" + localVarPath = strings.Replace(localVarPath, "{"+"jobId"+"}", fmt.Sprintf("%v", jobId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Severity.IsSet() { + localVarQueryParams.Add("severity", parameterToString(localVarOptionals.Severity.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Subject.IsSet() { + localVarQueryParams.Add("subject", parameterToString(localVarOptionals.Subject.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20026 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get cluster node information +Gets information about the nodes that currently make up the stash cluster. The authenticated user must have the <strong>SYS_ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestClusterInformation +*/ +func (a *SystemMaintenanceApiService) GetInformation(ctx context.Context) (RestClusterInformation, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestClusterInformation + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/cluster" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestClusterInformation + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get label +Returns a label. The user needs to be authenticated to use this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param labelName the label name +@return RestLabel +*/ +func (a *SystemMaintenanceApiService) GetLabel(ctx context.Context, labelName string) (RestLabel, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestLabel + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/labels/{labelName}" + localVarPath = strings.Replace(localVarPath, "{"+"labelName"+"}", fmt.Sprintf("%v", labelName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestLabel + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get labelables for label +Returns a page of labelables for a given label. Only labelables that the authenticated user has view access to will be returned. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param labelName The page of labelables. + * @param optional nil or *SystemMaintenanceApiGetLabelablesOpts - Optional Parameters: + * @param "Type_" (optional.String) - the type of labelables to be returned. Supported values: REPOSITORY + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20025 +*/ + +type SystemMaintenanceApiGetLabelablesOpts struct { + Type_ optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SystemMaintenanceApiService) GetLabelables(ctx context.Context, labelName string, localVarOptionals *SystemMaintenanceApiGetLabelablesOpts) (InlineResponse20025, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20025 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/labels/{labelName}/labeled" + localVarPath = strings.Replace(localVarPath, "{"+"labelName"+"}", fmt.Sprintf("%v", labelName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Type_.IsSet() { + localVarQueryParams.Add("type", parameterToString(localVarOptionals.Type_.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20025 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get all labels +Returns a paged response of all the labels in the system. The user needs to be authenticated to use this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiGetLabelsOpts - Optional Parameters: + * @param "Prefix" (optional.String) - (optional) prefix to filter the labels on. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20024 +*/ + +type SystemMaintenanceApiGetLabelsOpts struct { + Prefix optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SystemMaintenanceApiService) GetLabels(ctx context.Context, localVarOptionals *SystemMaintenanceApiGetLabelsOpts) (InlineResponse20024, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20024 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/labels" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Prefix.IsSet() { + localVarQueryParams.Add("prefix", parameterToString(localVarOptionals.Prefix.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20024 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get current log level +Retrieve the current log level for a given logger. The authenticated user must have <strong>ADMIN</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param loggerName The name of the logger. +@return RestLogLevel +*/ +func (a *SystemMaintenanceApiService) GetLevel(ctx context.Context, loggerName string) (RestLogLevel, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestLogLevel + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/logs/logger/{loggerName}" + localVarPath = strings.Replace(localVarPath, "{"+"loggerName"+"}", fmt.Sprintf("%v", loggerName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestLogLevel + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get mail configuration +Retrieves the current mail configuration. The authenticated user must have the <strong>SYS_ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestMailConfiguration +*/ +func (a *SystemMaintenanceApiService) GetMailConfig(ctx context.Context) (RestMailConfiguration, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMailConfiguration + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/mail-server" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMailConfiguration + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get Mesh migration job details +Gets the details, including the current status and progress, of the job identified by the given ID. The authenticated user must have **SYS_ADMIN** permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param jobId The ID of the job + +*/ +func (a *SystemMaintenanceApiService) GetMeshMigrationJob(ctx context.Context, jobId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/mesh/{jobId}" + localVarPath = strings.Replace(localVarPath, "{"+"jobId"+"}", fmt.Sprintf("%v", jobId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get Mesh migration job messages +Gets the messages generated by the job. Without any filter, all messages will be returned, but the response can optionally be filtered for the following severities. The severity parameter can be repeated to include multiple severities in one response. - INFO - WARN - ERROR The authenticated user must have **SYS_ADMIN** permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param jobId The ID of the job + * @param optional nil or *SystemMaintenanceApiGetMeshMigrationJobMessagesOpts - Optional Parameters: + * @param "Severity" (optional.String) - The severity to include in the results + * @param "Subject" (optional.String) - The subject + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20026 +*/ + +type SystemMaintenanceApiGetMeshMigrationJobMessagesOpts struct { + Severity optional.String + Subject optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SystemMaintenanceApiService) GetMeshMigrationJobMessages(ctx context.Context, jobId string, localVarOptionals *SystemMaintenanceApiGetMeshMigrationJobMessagesOpts) (InlineResponse20026, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20026 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/mesh/{jobId}/messages" + localVarPath = strings.Replace(localVarPath, "{"+"jobId"+"}", fmt.Sprintf("%v", jobId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Severity.IsSet() { + localVarQueryParams.Add("severity", parameterToString(localVarOptionals.Severity.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Subject.IsSet() { + localVarQueryParams.Add("subject", parameterToString(localVarOptionals.Subject.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20026 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get Mesh migration job summary +Gets the summary, including the queue status and progress, of a Mesh migration job. The authenticated user must have **SYS_ADMIN** permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param jobId The ID of the job +@return RestMeshMigrationSummary +*/ +func (a *SystemMaintenanceApiService) GetMeshMigrationJobSummary(ctx context.Context, jobId string) (RestMeshMigrationSummary, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMeshMigrationSummary + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/mesh/{jobId}/summary" + localVarPath = strings.Replace(localVarPath, "{"+"jobId"+"}", fmt.Sprintf("%v", jobId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMeshMigrationSummary + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get Mesh node +Get the registered Mesh node that matches the supplied ID. The authenticated user must have **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the Mesh node. +@return RestMeshNode +*/ +func (a *SystemMaintenanceApiService) GetRegisteredMeshNodeById(ctx context.Context, id string) (RestMeshNode, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMeshNode + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/git/mesh/nodes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMeshNode + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get repository archive policy +Retrieves the repository archive policy for the instance. The user must be authenticated to access this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestRepositoryPolicy +*/ +func (a *SystemMaintenanceApiService) GetRepositoryArchivePolicy(ctx context.Context) (RestRepositoryPolicy, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryPolicy + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/policies/latest/admin/repos/archive" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryPolicy + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get repository delete policy +Retrieves the repository delete policy for the instance. The user must be authenticated to access this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestRepositoryPolicy +*/ +func (a *SystemMaintenanceApiService) GetRepositoryDeletePolicy(ctx context.Context) (RestRepositoryPolicy, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryPolicy + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/policies/latest/admin/repos/delete" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryPolicy + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get root log level + Retrieve the current log level for the root logger. The authenticated user must have <strong>ADMIN</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestLogLevel +*/ +func (a *SystemMaintenanceApiService) GetRootLevel(ctx context.Context) (RestLogLevel, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestLogLevel + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/logs/rootLogger" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestLogLevel + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get server mail address +Retrieves the server email address + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *SystemMaintenanceApiService) GetSenderAddress(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/mail-server/sender-address" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get rate limit settings +Retrieves the rate limit settings for the instance. The user must be authenticated to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return RestRateLimitSettings +*/ +func (a *SystemMaintenanceApiService) GetSettings2(ctx context.Context) (RestRateLimitSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRateLimitSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/rate-limit/settings" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRateLimitSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get support zip for node +Get the support zip for the Mesh node that matches the specified ID. The authenticated user must have **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the Mesh node. + +*/ +func (a *SystemMaintenanceApiService) GetSupportZip(ctx context.Context, id string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/git/mesh/support-zips/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/octet-stream", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v RestErrors + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v RestErrors + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get support zips for all Mesh nodes +Get the support zips for all the Mesh nodes. The authenticated user must have **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *SystemMaintenanceApiService) GetSupportZips(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/git/mesh/support-zips" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/octet-stream", "application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v RestErrors + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get supported SSH key algorithms and lengths +Retrieves a list of all supported SSH key algorithms and lengths. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + +*/ +func (a *SystemMaintenanceApiService) GetSupportedKeyTypes(ctx context.Context) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/admin/supported-key-types" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get user +Retrieve the user matching the supplied <strong>userSlug</strong>. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userSlug The user slug +@return RestApplicationUser +*/ +func (a *SystemMaintenanceApiService) GetUser(ctx context.Context, userSlug string) (RestApplicationUser, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestApplicationUser + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/users/{userSlug}" + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestApplicationUser + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get user settings +Retrieve a map of user setting key values for a specific user identified by the user slug. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userSlug The user slug. +@return ExampleSettingsMap +*/ +func (a *SystemMaintenanceApiService) GetUserSettings(ctx context.Context, userSlug string) (ExampleSettingsMap, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExampleSettingsMap + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/users/{userSlug}/settings" + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ExampleSettingsMap + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get all users +Retrieve a page of users, optionally run through provided filters. Only authenticated users may call this resource. ### Permission Filters 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>, <code>permission.1</code> etc.) depending on the permission resource. The system determines which filter to apply (Global, Project or Repository permission) based on the `[root]` permission value. E.g. <code>ADMIN</code> is a global permission, <code>PROJECT_ADMIN</code> is a project permission and <code>REPO_ADMIN</code> 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</code> and <code>projectKey</code> are provided, the system will use <code>projectId</code> for the lookup. <h4>Global permissions</h4> The permission value under <code>[root]</code> is the only required and recognized parameter, as global permissions do not apply to a specific resource. Example valid filter: <code>permission=ADMIN</code>. <h4>Project permissions</h4> - <code>[root]</code>- specifies the project permission - <code>[root].projectId</code> - specifies the project ID to lookup the project by - <code>[root].projectKey</code> - specifies the project key to lookup the project by Example valid filter: <code>permission.1=PROJECT_ADMIN&amp;permission.1.projectKey=TEST_PROJECT</code>. #### Repository permissions - <code>[root]</code>- specifies the repository permission - <code>[root].projectId</code> - specifies the repository ID to lookup the repository by - <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 Example valid filter: <code>permission.2=REPO_ADMIN&amp;permission.2.projectKey=TEST_PROJECT&amp;permission.2.repositorySlug=test_repo</code>. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiGetUsers2Opts - Optional Parameters: + * @param "Filter" (optional.String) - Return only users, whose username, name or email address <i>contain</i> the <code> filter</code> value + * @param "PermissionN" (optional.String) - The \"root\" of a single permission filter, similar to the <code>permission</code> 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>, <code>permission.2</code> 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\" above for more details on how the permission filters are processed. + * @param "Permission" (optional.String) - 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\" above for more details. + * @param "Group" (optional.String) - return only users who are members of the given group +@return RestApplicationUser +*/ + +type SystemMaintenanceApiGetUsers2Opts struct { + Filter optional.String + PermissionN optional.String + Permission optional.String + Group optional.String +} + +func (a *SystemMaintenanceApiService) GetUsers2(ctx context.Context, localVarOptionals *SystemMaintenanceApiGetUsers2Opts) (RestApplicationUser, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestApplicationUser + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.Filter.IsSet() { + localVarQueryParams.Add("filter", parameterToString(localVarOptionals.Filter.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.PermissionN.IsSet() { + localVarQueryParams.Add("permission.N", parameterToString(localVarOptionals.PermissionN.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Permission.IsSet() { + localVarQueryParams.Add("permission", parameterToString(localVarOptionals.Permission.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Group.IsSet() { + localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestApplicationUser + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Preview export +Enumerates the projects and repositories that would be exported for a given export request. All affected repositories will be enumerated explicitly, and while projects are listed as individual items in responses from this endpoint, their presence does not imply that all their repositories are included. While this endpoint can be used to verify that all selectors in the request apply as intended, it should be noted that a subsequent, actual export might contain a different set of repositories, as they might have been added or deleted in the meantime. Note that the overall response from this endpoint can become very large when a lot of repositories end up in the selection. This is why the server is streaming the response while it is being generated (as opposed to creating it in memory and then sending it all at once) and it can be consumed in a streaming way, too. Also, due to the potential size of the response, projects and repositories are listed with fewer details than in other REST responses. For a more detailed description of selectors, see the endpoint documentation for starting an export. The authenticated user must have **ADMIN** permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiPreviewExportOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestExportRequest) - the export request +@return RestScopesExample +*/ + +type SystemMaintenanceApiPreviewExportOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) PreviewExport(ctx context.Context, localVarOptionals *SystemMaintenanceApiPreviewExportOpts) (RestScopesExample, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestScopesExample + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/exports/preview" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestScopesExample + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Preview Mesh migration +Enumerates the projects and repositories that would be migrated for a given request. All affected repositories will be enumerated explicitly, and while projects are listed as individual items in responses from this endpoint, their presence does not imply that all their repositories are included. While this endpoint can be used to verify that all selectors in the request apply as intended, it should be noted that a subsequent, actual export might contain a different set of repositories, as they might have been added or deleted in the meantime. Note that the overall response from this endpoint can become very large when a lot of repositories end up in the selection. This is why the server is streaming the response while it is being generated (as opposed to creating it in memory and then sending it all at once) and it can be consumed in a streaming way, too. Also, due to the potential size of the response, projects and repositories are listed with fewer details than in other REST responses. The authenticated user must have **SYS_ADMIN** permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiPreviewMeshMigrationOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestMeshMigrationRequest) - The export request +@return ExamplePreviewMigration +*/ + +type SystemMaintenanceApiPreviewMeshMigrationOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) PreviewMeshMigration(ctx context.Context, localVarOptionals *SystemMaintenanceApiPreviewMeshMigrationOpts) (ExamplePreviewMigration, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue ExamplePreviewMigration + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/mesh/preview" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v ExamplePreviewMigration + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Get hook script content +Retrieves the hook script content. This endpoint requires **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param scriptId The ID of the hook script + +*/ +func (a *SystemMaintenanceApiService) Read(ctx context.Context, scriptId string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/hook-scripts/{scriptId}/content" + localVarPath = strings.Replace(localVarPath, "{"+"scriptId"+"}", fmt.Sprintf("%v", scriptId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Register new Mesh node +Register a new Mesh node. The authenticated user must have **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiRegisterNewMeshNodeOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestMeshNode) - The request specifying the new Mesh node. +@return RestMeshNode +*/ + +type SystemMaintenanceApiRegisterNewMeshNodeOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) RegisterNewMeshNode(ctx context.Context, localVarOptionals *SystemMaintenanceApiRegisterNewMeshNodeOpts) (RestMeshNode, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMeshNode + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/git/mesh/nodes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMeshNode + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Find repositories by Mesh migration state +Searches for repositories in the system matching the specified criteria and enriches their MeshMigrationQueueState migration state if a migration is currently in progress. The currently active migration can optionally be specified by passing a migrationId, if known. If this isn't passed, an attempt is made to locate the active migration and its ID is used. If a migration is currently active, only repositories that are a part of the migration are filtered and returned. Otherwise, all repositories in the systems are filtered and returned. Filtering by state is ignored when no migration is currently in progress. In such a case, results are not enriched with their MeshMigrationQueueState migration state. The authenticated user must have **SYS_ADMIN** permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiSearchMeshMigrationReposOpts - Optional Parameters: + * @param "MigrationId" (optional.String) - (optional) The currently active migration job. If not passed, this is looked up internally. + * @param "ProjectKey" (optional.String) - (optional) The project key. Can be specified more than once to filter by more than one project. + * @param "Name" (optional.String) - (optional) The repository name + * @param "State" (optional.String) - (optional) If a migration is active, the MeshMigrationQueueState state to filter results by. Can be specified more than once to filter by more than one state. + * @param "Remote" (optional.String) - (optional) Whether the repository has been fully migrated to Mesh. If not present, all repositories are considered regardless of where they're located. + * @param "Start" (optional.Float64) - Start number for the page (inclusive). If not passed, first page is assumed. + * @param "Limit" (optional.Float64) - Number of items to return. If not passed, a page size of 25 is used. +@return InlineResponse20027 +*/ + +type SystemMaintenanceApiSearchMeshMigrationReposOpts struct { + MigrationId optional.String + ProjectKey optional.String + Name optional.String + State optional.String + Remote optional.String + Start optional.Float64 + Limit optional.Float64 +} + +func (a *SystemMaintenanceApiService) SearchMeshMigrationRepos(ctx context.Context, localVarOptionals *SystemMaintenanceApiSearchMeshMigrationReposOpts) (InlineResponse20027, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20027 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/mesh/repos" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if localVarOptionals != nil && localVarOptionals.MigrationId.IsSet() { + localVarQueryParams.Add("migrationId", parameterToString(localVarOptionals.MigrationId.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ProjectKey.IsSet() { + localVarQueryParams.Add("projectKey", parameterToString(localVarOptionals.ProjectKey.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Name.IsSet() { + localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.State.IsSet() { + localVarQueryParams.Add("state", parameterToString(localVarOptionals.State.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Remote.IsSet() { + localVarQueryParams.Add("remote", parameterToString(localVarOptionals.Remote.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Start.IsSet() { + localVarQueryParams.Add("start", parameterToString(localVarOptionals.Start.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Limit.IsSet() { + localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), "")) + } + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v InlineResponse20027 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Set rate limit settings for users +Sets the given rate limit settings for the given users. The authenticated user must have <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiSetOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestBulkUserRateLimitSettingsUpdateRequest) - +@return RestUserRateLimitSettings +*/ + +type SystemMaintenanceApiSetOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) Set(ctx context.Context, localVarOptionals *SystemMaintenanceApiSetOpts) (RestUserRateLimitSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestUserRateLimitSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/rate-limit/settings/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestUserRateLimitSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Set rate limit settings for user +Sets the given rate limit settings for the given user. The authenticated user must have <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userSlug The user slug. + * @param optional nil or *SystemMaintenanceApiSet1Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestUserRateLimitSettingsUpdateRequest) - +@return RestUserRateLimitSettings +*/ + +type SystemMaintenanceApiSet1Opts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) Set1(ctx context.Context, userSlug string, localVarOptionals *SystemMaintenanceApiSet1Opts) (RestUserRateLimitSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestUserRateLimitSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/rate-limit/settings/users/{userSlug}" + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestUserRateLimitSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update/Set announcement banner +Sets the announcement banner with the provided JSON. Only users authenticated as Admins may call this resource + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiSetBannerOpts - Optional Parameters: + * @param "Body" (optional.Interface of AdminBannerBody) - + +*/ + +type SystemMaintenanceApiSetBannerOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) SetBanner(ctx context.Context, localVarOptionals *SystemMaintenanceApiSetBannerOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/banner" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update/Set default branch +Configures the global default branch, which is used when creating new repositories if an explicit default branch is not specified. The authenticated user must have <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiSetDefaultBranchOpts - Optional Parameters: + * @param "Body" (optional.Interface of AdminDefaultbranchBody) - + +*/ + +type SystemMaintenanceApiSetDefaultBranchOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) SetDefaultBranch(ctx context.Context, localVarOptionals *SystemMaintenanceApiSetDefaultBranchOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/default-branch" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Set log level +Set the current log level for a given logger. The authenticated user must have <strong>ADMIN</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param levelName The level to set the logger to. Either TRACE, DEBUG, INFO, WARN or ERROR + * @param loggerName The name of the logger. + +*/ +func (a *SystemMaintenanceApiService) SetLevel(ctx context.Context, levelName string, loggerName string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/logs/logger/{loggerName}/{levelName}" + localVarPath = strings.Replace(localVarPath, "{"+"levelName"+"}", fmt.Sprintf("%v", levelName), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loggerName"+"}", fmt.Sprintf("%v", loggerName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update mail configuration +Updates the mail configuration. The authenticated user must have the <strong>SYS_ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiSetMailConfigOpts - Optional Parameters: + * @param "Body" (optional.Interface of AdminMailserverBody) - +@return RestMailConfiguration +*/ + +type SystemMaintenanceApiSetMailConfigOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) SetMailConfig(ctx context.Context, localVarOptionals *SystemMaintenanceApiSetMailConfigOpts) (RestMailConfiguration, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMailConfiguration + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/mail-server" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMailConfiguration + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update repository archive policy +Sets the repository archive policy for the instance. The authenticated user must have <b>SYS_ADMIN</b> permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiSetRepositoryArchivePolicyOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestRepositoryPolicy) - The request containing the details of the policy. +@return RestRepositoryPolicy +*/ + +type SystemMaintenanceApiSetRepositoryArchivePolicyOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) SetRepositoryArchivePolicy(ctx context.Context, localVarOptionals *SystemMaintenanceApiSetRepositoryArchivePolicyOpts) (RestRepositoryPolicy, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryPolicy + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/policies/latest/admin/repos/archive" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryPolicy + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update the repository delete policy +Sets the repository delete policy for the instance. The authenticated user must have <b>SYS_ADMIN</b> permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiSetRepositoryDeletePolicyOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestRepositoryPolicy) - The request containing the details of the policy. +@return RestRepositoryPolicy +*/ + +type SystemMaintenanceApiSetRepositoryDeletePolicyOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) SetRepositoryDeletePolicy(ctx context.Context, localVarOptionals *SystemMaintenanceApiSetRepositoryDeletePolicyOpts) (RestRepositoryPolicy, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRepositoryPolicy + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/policies/latest/admin/repos/delete" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRepositoryPolicy + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Set root log level +Set the current log level for the root logger. The authenticated user must have <strong>ADMIN</strong> permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param levelName the level to set the logger to. Either TRACE, DEBUG, INFO, WARN or ERROR + +*/ +func (a *SystemMaintenanceApiService) SetRootLevel(ctx context.Context, levelName string) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/logs/rootLogger/{levelName}" + localVarPath = strings.Replace(localVarPath, "{"+"levelName"+"}", fmt.Sprintf("%v", levelName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update server mail address +Updates the server email address The authenticated user must have the <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiSetSenderAddressOpts - Optional Parameters: + * @param "Body" (optional.Interface of string) - + +*/ + +type SystemMaintenanceApiSetSenderAddressOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) SetSenderAddress(ctx context.Context, localVarOptionals *SystemMaintenanceApiSetSenderAddressOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/mail-server/sender-address" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Set rate limit +Sets the rate limit settings for the instance. The authenticated user must have <strong>ADMIN</strong> permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiSetSettings2Opts - Optional Parameters: + * @param "Body" (optional.Interface of RestRateLimitSettings) - Sets the rate limit settings for the instance. + +The authenticated user must have <strong>ADMIN</strong> permission to call this resource. +@return RestRateLimitSettings +*/ + +type SystemMaintenanceApiSetSettings2Opts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) SetSettings2(ctx context.Context, localVarOptionals *SystemMaintenanceApiSetSettings2Opts) (RestRateLimitSettings, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestRateLimitSettings + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/rate-limit/settings" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestRateLimitSettings + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Start export job +Starts a background job that exports the selected repositories. Only 2 concurrent exports are supported _per cluster node_. If a request ends up on a node that is already running that many export jobs, the request will be rejected and an error returned. The response includes a description of the job that has been started, and its ID can be used to query these details again, including the current progress, warnings and errors that occurred while processing the job, and to interrupt and cancel the execution of this job. The request to start an export is similar to the one for previewing an export. Additionally, it accepts an optional parameter, `exportLocation`, which can be used to specify a _relative_ path within `data/migration/export` in the shared home directory. No locations outside of that directory will be accepted for exports. There are essentially three ways to select repositories for export. Regardless of which you use, a few general rules apply: - You can supply a list of selectors. The selection will be additive. - Repositories that are selected more than once due to overlapping selectors will be de-duplicated and effectively exported only once. - For every selected repository, its full fork hierarchy will be considered selected, even if parts of that hierarchy would otherwise not be matched by the provided selectors. For example, when you explicitly select a single repository only, but that repository is a fork, then its origin will be exported (and eventually imported), too. Now, a single repository can be selected like this: ``` { \"projectKey\": \"PRJ\", \"slug\": \"my-repo\" } ``` Second, all repositories in a specific project can be selected like this: ``` { \"projectKey\": \"PRJ\", \"slug\": *\" } ``` And third, all projects and repositories in the system would be selected like this: ``` { \"projectKey\": \"*\", \"slug\": *\" } ``` The authenticated user must have **ADMIN** permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiStartExportOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestExportRequest) - The request +@return RestJob +*/ + +type SystemMaintenanceApiStartExportOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) StartExport(ctx context.Context, localVarOptionals *SystemMaintenanceApiStartExportOpts) (RestJob, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestJob + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/exports" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestJob + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 503 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Start import job +Starts a background job that imports the specified archive. Only 1 import at a time is supported _per cluster_. If another request is made while an import is already running, the request will be rejected and an error returned. The path in the request must point to a valid archive file. The file must be located within the `data/migration/import` directory in the shared home directory. The authenticated user must have **ADMIN** permission or higher to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiStartImportOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestImportRequest) - The request +@return RestJob +*/ + +type SystemMaintenanceApiStartImportOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) StartImport(ctx context.Context, localVarOptionals *SystemMaintenanceApiStartImportOpts) (RestJob, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestJob + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/imports" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestJob + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 503 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Start Mesh migration job +Starts a background job that migrates selected projects/repositories to Mesh. Only 1 job is supported _per cluster_. The response includes a description of the job that has been started, and its ID can be used to query these details again, including the current progress, and to interrupt and cancel the execution of this job. The request to start a migration is similar to the one for previewing a migration. There are essentially three ways to select repositories for migration. Regardless of which you use, a few general rules apply: - You can supply a list of repository IDs and project IDs. The selection will be additive. All repositories in the system are migrated if both lists are empty. - Repositories that are selected more than once due to overlapping IDs will be de-duplicated and effectively migrated only once. - For every selected repository, its full fork hierarchy will be considered selected, even if parts of that hierarchy would otherwise not be matched by the provided IDs. For example, when you explicitly select a single repository only, but that repository is a fork, then its origin will be migrated too. Now, a single repository can be selected like this: ``` { \"repositoryIds\": [1] } ``` Multiple repositories can be selected like this: ``` { \"repositoryIds\": [1, 2] } ``` Second, all repositories in a specific project can be selected like this: ``` { \"projectIds\": [1] } ``` And third, all projects and repositories in the system would be selected like this: ``` { \"projectIds\": [], \"repositoryIds\": [] } ``` The authenticated user must have **SYS_ADMIN** permission to call this resource. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiStartMeshMigrationOpts - Optional Parameters: + * @param "Body" (optional.Interface of MigrationMeshBody) - +@return RestJob +*/ + +type SystemMaintenanceApiStartMeshMigrationOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) StartMeshMigration(ctx context.Context, localVarOptionals *SystemMaintenanceApiStartMeshMigrationOpts) (RestJob, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestJob + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/migration/mesh" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestJob + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 503 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update global SSH key settings +Updates the global settings that enforces the maximum expiry of SSH keys and restrictions on SSH key types. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiUpdateGlobalSettingsOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestSshKeySettings) - A request containing expiry length to be set for SSH keys and a list of SSH key type restrictions. + +*/ + +type SystemMaintenanceApiUpdateGlobalSettingsOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) UpdateGlobalSettings(ctx context.Context, localVarOptionals *SystemMaintenanceApiUpdateGlobalSettingsOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/admin" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update a hook script +Updates a hook script. This endpoint requires **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param scriptId The ID of the hook script + * @param optional nil or *SystemMaintenanceApiUpdateHookScriptOpts - Optional Parameters: + * @param "Body" (optional.Interface of ExamplePutMultipartFormData) - The multipart form data containing the hook script +@return RestHookScript +*/ + +type SystemMaintenanceApiUpdateHookScriptOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) UpdateHookScript(ctx context.Context, scriptId string, localVarOptionals *SystemMaintenanceApiUpdateHookScriptOpts) (RestHookScript, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestHookScript + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/hook-scripts/{scriptId}" + localVarPath = strings.Replace(localVarPath, "{"+"scriptId"+"}", fmt.Sprintf("%v", scriptId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"*/*"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestHookScript + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 422 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update license +Decodes the provided encoded license and sets it as the active license. If no license was provided, a 400 is returned. If the license cannot be decoded, or cannot be applied, a 409 is returned. Some possible reasons a license may not be applied include: - It is for a different product - It is already expired Otherwise, if the license is updated successfully, details for the new license are returned with a 200 response. <b>Warning</b>: It is possible to downgrade the license during update, applying a license with a lower number of permitted users. If the number of currently-licensed users exceeds the limits of the new license, pushing will be disabled until the licensed user count is brought into compliance with the new license. The authenticated user must have <b>SYS_ADMIN</b> permission. <b>ADMIN</b> users may <i>view</i> the current license details, but they may not <i>update</i> the license. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiUpdateLicenseOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestBitbucketLicense) - a JSON payload containing the encoded license to apply +@return RestBitbucketLicense +*/ + +type SystemMaintenanceApiUpdateLicenseOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) UpdateLicense(ctx context.Context, localVarOptionals *SystemMaintenanceApiUpdateLicenseOpts) (RestBitbucketLicense, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestBitbucketLicense + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/license" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestBitbucketLicense + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 409 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update Mesh node +Update a Mesh node. The authenticated user must have **SYS_ADMIN** permission. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param id The ID of the Mesh node to update. + * @param optional nil or *SystemMaintenanceApiUpdateMeshNodeOpts - Optional Parameters: + * @param "Body" (optional.Interface of RestMeshNode) - The request specifying the updated Mesh node. +@return RestMeshNode +*/ + +type SystemMaintenanceApiUpdateMeshNodeOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) UpdateMeshNode(ctx context.Context, id string, localVarOptionals *SystemMaintenanceApiUpdateMeshNodeOpts) (RestMeshNode, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestMeshNode + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/admin/git/mesh/nodes/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestMeshNode + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update user settings +Update the entries of a map of user setting key/values for a specific user identified by the user slug. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userSlug The user slug. + * @param optional nil or *SystemMaintenanceApiUpdateSettingsOpts - Optional Parameters: + * @param "Body" (optional.Interface of ExampleSettingsMap) - A map with the UserSettings entries which must be updated. + +*/ + +type SystemMaintenanceApiUpdateSettingsOpts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) UpdateSettings(ctx context.Context, userSlug string, localVarOptionals *SystemMaintenanceApiUpdateSettingsOpts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/users/{userSlug}/settings" + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update user details +Update the currently authenticated user's details. The update will always be applied to the currently authenticated user. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiUpdateUserDetails1Opts - Optional Parameters: + * @param "Body" (optional.Interface of UserUpdate) - The user update details +@return RestApplicationUser +*/ + +type SystemMaintenanceApiUpdateUserDetails1Opts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) UpdateUserDetails1(ctx context.Context, localVarOptionals *SystemMaintenanceApiUpdateUserDetails1Opts) (RestApplicationUser, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RestApplicationUser + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v RestApplicationUser + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Set password +Update the currently authenticated user's password. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *SystemMaintenanceApiUpdateUserPassword1Opts - Optional Parameters: + * @param "Body" (optional.Interface of UserPasswordUpdate) - The password update details + +*/ + +type SystemMaintenanceApiUpdateUserPassword1Opts struct { + Body optional.Interface +} + +func (a *SystemMaintenanceApiService) UpdateUserPassword1(ctx context.Context, localVarOptionals *SystemMaintenanceApiUpdateUserPassword1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/users/credentials" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + if localVarOptionals != nil && localVarOptionals.Body.IsSet() { + + localVarOptionalBody:= localVarOptionals.Body.Value() + localVarPostBody = &localVarOptionalBody + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 400 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} +/* +SystemMaintenanceApiService Update user avatar +Update the avatar for the user with the supplied <strong>slug</strong>. This resource accepts POST multipart form data, containing a single image in a form-field named 'avatar'. There are configurable server limits on both the dimensions (1024x1024 pixels by default) and uploaded file size (1MB by default). Several different image formats are supported, but <strong>PNG</strong> and <strong>JPEG</strong> are preferred due to the file size limit. This resource has Cross-Site Request Forgery (XSRF) protection. To allow the request to pass the XSRF check the caller needs to send an <code>X-Atlassian-Token</code> HTTP header with the value <code>no-check</code>. An example <a href=\"http://curl.haxx.se/\">curl</a> request to upload an image name 'avatar.png' would be: ``` curl -X POST -u username:password -H \"X-Atlassian-Token: no-check\" http://example.com/rest/api/latest/users/jdoe/avatar.png -F avatar=@avatar.png ``` Users are always allowed to update their own avatar. To update someone else's avatar the authenticated user must have global <strong>ADMIN</strong> permission, or global <strong>SYS_ADMIN</strong> permission to update a <strong>SYS_ADMIN</strong> user's avatar. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param userSlug The user slug + * @param optional nil or *SystemMaintenanceApiUploadAvatar1Opts - Optional Parameters: + * @param "Avatar" (optional.*os.File) - + * @param "XAtlassianToken" (optional.String) - This resource has Cross-Site Request Forgery (XSRF) protection. To allow the request to pass the XSRF check the caller needs to send an <code>X-Atlassian-Token</code> HTTP header with the value <code>no-check</code>. + +*/ + +type SystemMaintenanceApiUploadAvatar1Opts struct { + Avatar optional.Interface + XAtlassianToken optional.String +} + +func (a *SystemMaintenanceApiService) UploadAvatar1(ctx context.Context, userSlug string, localVarOptionals *SystemMaintenanceApiUploadAvatar1Opts) (*http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/api/latest/users/{userSlug}/avatar.png" + localVarPath = strings.Replace(localVarPath, "{"+"userSlug"+"}", fmt.Sprintf("%v", userSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"multipart/form-data"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if localVarOptionals != nil && localVarOptionals.XAtlassianToken.IsSet() { + localVarHeaderParams["X-Atlassian-Token"] = parameterToString(localVarOptionals.XAtlassianToken.Value(), "") + } + var localVarFile *os.File + if localVarOptionals != nil && localVarOptionals.Avatar.IsSet() { + localVarFileOk := false + localVarFile, localVarFileOk = localVarOptionals.Avatar.Value().(*os.File) + if !localVarFileOk { + return nil, reportError("avatar should be *os.File") + } + } + if localVarFile != nil { + fbs, _ := ioutil.ReadAll(localVarFile) + localVarFileBytes = fbs + localVarFileName = localVarFile.Name() + localVarFile.Close() + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarHttpResponse, err + } + + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 401 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + if localVarHttpResponse.StatusCode == 404 { + var v InlineResponse401 + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarHttpResponse, newErr + } + newErr.model = v + return localVarHttpResponse, newErr + } + return localVarHttpResponse, newErr + } + + return localVarHttpResponse, nil +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/client.go b/vendor/github.com/gdasson/bitbucketv1go/client.go new file mode 100644 index 000000000..166fc3d0c --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/client.go @@ -0,0 +1,518 @@ +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") + xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") +) + +// APIClient manages communication with the Bitbucket Server API v8.14 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + AuthenticationApi *AuthenticationApiService + + BuildsAndDeploymentsApi *BuildsAndDeploymentsApiService + + CapabilitiesApi *CapabilitiesApiService + + DashboardApi *DashboardApiService + + DefaultApi *DefaultApiService + + DeprecatedApi *DeprecatedApiService + + JiraIntegrationApi *JiraIntegrationApiService + + MarkupApi *MarkupApiService + + MirroringMirrorApi *MirroringMirrorApiService + + MirroringUpstreamApi *MirroringUpstreamApiService + + PermissionManagementApi *PermissionManagementApiService + + ProjectApi *ProjectApiService + + PullRequestsApi *PullRequestsApiService + + RepositoryApi *RepositoryApiService + + SecurityApi *SecurityApiService + + SystemMaintenanceApi *SystemMaintenanceApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.AuthenticationApi = (*AuthenticationApiService)(&c.common) + c.BuildsAndDeploymentsApi = (*BuildsAndDeploymentsApiService)(&c.common) + c.CapabilitiesApi = (*CapabilitiesApiService)(&c.common) + c.DashboardApi = (*DashboardApiService)(&c.common) + c.DefaultApi = (*DefaultApiService)(&c.common) + c.DeprecatedApi = (*DeprecatedApiService)(&c.common) + c.JiraIntegrationApi = (*JiraIntegrationApiService)(&c.common) + c.MarkupApi = (*MarkupApiService)(&c.common) + c.MirroringMirrorApi = (*MirroringMirrorApiService)(&c.common) + c.MirroringUpstreamApi = (*MirroringUpstreamApiService)(&c.common) + c.PermissionManagementApi = (*PermissionManagementApiService)(&c.common) + c.ProjectApi = (*ProjectApiService)(&c.common) + c.PullRequestsApi = (*PullRequestsApiService)(&c.common) + c.RepositoryApi = (*RepositoryApiService)(&c.common) + c.SecurityApi = (*SecurityApiService)(&c.common) + c.SystemMaintenanceApi = (*SystemMaintenanceApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } + + return fmt.Sprintf("%v", obj) +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + return c.cfg.HTTPClient.Do(request) +} + +// Change base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile("file", filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + } + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Override request host, if applicable + if c.cfg.Host != "" { + localVarRequest.Host = c.cfg.Host + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } + expires = now.Add(lifetime) + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericSwaggerError Provides access to the body, error and model on returned errors. +type GenericSwaggerError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericSwaggerError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericSwaggerError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericSwaggerError) Model() interface{} { + return e.model +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/configuration.go b/vendor/github.com/gdasson/bitbucketv1go/configuration.go new file mode 100644 index 000000000..409d81c9a --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/configuration.go @@ -0,0 +1,71 @@ +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "net/http" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +type Configuration struct { + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + HTTPClient *http.Client +} + +func NewConfiguration() *Configuration { + cfg := &Configuration{ + BasePath: "http://{baseurl}/rest", + DefaultHeader: make(map[string]string), + UserAgent: "Swagger-Codegen/1.0.0/go", + } + return cfg +} + +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/models.go b/vendor/github.com/gdasson/bitbucketv1go/models.go new file mode 100644 index 000000000..7c0f175f7 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/models.go @@ -0,0 +1,5504 @@ +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucketv1go + +import ( + "os" + "time" +) + +type AdminBannerBody struct { + Audience string `json:"audience"` + Enabled bool `json:"enabled,omitempty"` + Message string `json:"message,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type AdminDefaultbranchBody struct { + Id string `json:"id,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type AdminMailserverBody struct { + Hostname string `json:"hostname,omitempty"` + Password string `json:"password,omitempty"` + Port int32 `json:"port,omitempty"` + Protocol string `json:"protocol,omitempty"` + RequireStartTls bool `json:"requireStartTls,omitempty"` + SenderAddress string `json:"senderAddress,omitempty"` + UseStartTls bool `json:"useStartTls,omitempty"` + Username string `json:"username,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type AdminPasswordUpdate struct { + Name string `json:"name,omitempty"` + Password string `json:"password,omitempty"` + PasswordConfirm string `json:"passwordConfirm,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ApilatestmigrationmeshMaxBytesPerSecond struct { + AsLong int64 `json:"asLong,omitempty"` + Present bool `json:"present,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ApplicationId struct { +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ApplicationUser struct { + Id int32 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Slug string `json:"slug,omitempty"` + Active bool `json:"active,omitempty"` + Name string `json:"name,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ConditionIdBody struct { + RequiredApprovals int32 `json:"requiredApprovals,omitempty"` + Reviewers []RestApplicationUser `json:"reviewers,omitempty"` + SourceMatcher *DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcher `json:"sourceMatcher,omitempty"` + TargetMatcher *DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcher `json:"targetMatcher,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type Context struct { + CommitMessage string `json:"commitMessage,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type Credentials struct { + RestUsernamePasswordCredentials + RestBearerTokenCredentials + RestSshCredentials +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcher struct { + DisplayId string `json:"displayId,omitempty"` + Id string `json:"id,omitempty"` + Type_ *DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcherType `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcherType struct { + Id string `json:"id,omitempty"` + Name string `json:"name,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type EnrichedRepository struct { + Properties *EnrichedRepositoryProperties `json:"properties,omitempty"` + Name string `json:"name,omitempty"` + Id int32 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Public bool `json:"public,omitempty"` + Project *RestPullRequestFromRefRepositoryProject `json:"project,omitempty"` + Description string `json:"description,omitempty"` + DefaultBranch string `json:"defaultBranch,omitempty"` + RelatedLinks *interface{} `json:"relatedLinks,omitempty"` + Partition int32 `json:"partition,omitempty"` + Origin *RestPullRequestFromRefRepositoryOrigin `json:"origin,omitempty"` + HierarchyId string `json:"hierarchyId,omitempty"` + StatusMessage string `json:"statusMessage,omitempty"` + Archived bool `json:"archived,omitempty"` + Forkable bool `json:"forkable,omitempty"` + ScmId string `json:"scmId,omitempty"` + Slug string `json:"slug,omitempty"` + Scope string `json:"scope,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type EnrichedRepositoryProperties struct { + ContentHash string `json:"contentHash,omitempty"` + MetadataHash string `json:"metadataHash,omitempty"` + DefaultBranchId string `json:"defaultBranchId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type EntityHolderRestPullRequestAutoMergeRequest struct { + Entity *EntityHolderRestPullRequestAutoMergeRequestEntity `json:"entity,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type EntityHolderRestPullRequestAutoMergeRequestEntity struct { + AutoSubject string `json:"autoSubject,omitempty"` + Message string `json:"message,omitempty"` + StrategyId string `json:"strategyId,omitempty"` + Version int32 `json:"version,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type EntityHolderRestPullRequestDeclineRequest struct { + Entity *EntityHolderRestPullRequestDeclineRequestEntity `json:"entity,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type EntityHolderRestPullRequestDeclineRequestEntity struct { + Comment string `json:"comment,omitempty"` + Version int32 `json:"version,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type EntityHolderRestPullRequestReopenRequest struct { + Entity *EntityHolderRestPullRequestReopenRequestEntity `json:"entity,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type EntityHolderRestPullRequestReopenRequestEntity struct { + Version int32 `json:"version,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExampleAvatarMultipartFormData struct { + // The avatar file to upload. + Avatar **os.File `json:"avatar,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExampleFiles struct { + Files *ExampleJsonLastModifiedCallback `json:"files,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExampleJsonLastModifiedCallback struct { + PomXml *RestChangesetToCommit `json:"pomXml,omitempty"` + ReadmeMd *RestChangesetToCommit `json:"readmeMd,omitempty"` + LatestCommit *RestChangesetToCommit `json:"latestCommit,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExampleMultipartFormData struct { + // The branch on which the path should be modified or created. + Branch string `json:"branch,omitempty"` + // The full content of the file at path. + Content string `json:"content,omitempty"` + // The message associated with this change, to be used as the commit message. Or null if the default message should be used. + Message string `json:"message,omitempty"` + // The starting point for branch. If provided and different from branch, branch will be created as a new branch, branching off from sourceBranch. + SourceBranch string `json:"sourceBranch,omitempty"` + // The commit ID of the file before it was edited, used to identify if content has changed. Or null if this is a new file + SourceCommitId string `json:"sourceCommitId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExamplePostMultipartFormData struct { + // The hook script contents. + Content string `json:"content,omitempty"` + // A description of the hook script (useful when querying registered hook scripts). + Description string `json:"description,omitempty"` + // The name of the hook script (useful when querying registered hook scripts). + Name string `json:"name,omitempty"` + // The type of hook script; supported values are \"PRE\" for pre-receive hooks and \"POST\" for post-receive hooks. + Type_ string `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExamplePreviewMigration struct { + Repositories []RestRepository `json:"repositories,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExamplePutMultipartFormData struct { + // The hook script contents. + Content string `json:"content,omitempty"` + // A description of the hook script (useful when querying registered hook scripts). + Description string `json:"description,omitempty"` + // The name of the hook script (useful when querying registered hook scripts). + Name string `json:"name,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExampleRequirements struct { + Enabled bool `json:"enabled,omitempty"` + Count string `json:"count,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExampleSettings struct { + StringValue string `json:"stringValue,omitempty"` + BooleanValue bool `json:"booleanValue,omitempty"` + DoubleValue float64 `json:"doubleValue,omitempty"` + IntegerValue int32 `json:"integerValue,omitempty"` + LongValue int64 `json:"longValue,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExampleSettingsMap struct { + StringKey string `json:"string key,omitempty"` + BooleanKey bool `json:"boolean key,omitempty"` + LongKey float64 `json:"long key,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExampleSocketAddress struct { + Address string `json:"address,omitempty"` + Port int32 `json:"port,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type ExampleStatus struct { + ServerId string `json:"serverId,omitempty"` + CurrentNumberOfUsers int32 `json:"currentNumberOfUsers,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type FilePart struct { + ContentType string `json:"contentType,omitempty"` + FormField bool `json:"formField,omitempty"` + InputStream *interface{} `json:"inputStream,omitempty"` + Name string `json:"name,omitempty"` + Size int64 `json:"size,omitempty"` + Value string `json:"value,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type Group struct { + Name string `json:"name,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type GroupAndUsers struct { + Group string `json:"group,omitempty"` + Users []string `json:"users"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type GroupPickerContext struct { + Context string `json:"context,omitempty"` + ItemName string `json:"itemName,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse200 struct { + Values []RestAccessToken `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse2001 struct { + Values []RestBuildStatus `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20010 struct { + Values []RestMirrorServer `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20011 struct { + Values []EnrichedRepository `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20012 struct { + Values []RestMirroringRequest `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20013 struct { + Values []RestRefRestriction `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20014 struct { + Values []RestSshAccessKey `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20015 struct { + Values []RestSshKey `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20016 struct { + Values []RestDetailedGroup `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20017 struct { + Values []RestDetailedUser `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20018 struct { + Values []RestPermittedGroup `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20019 struct { + Values []RestAggregateRejectCounter `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse2002 struct { + Values []RestRequiredBuildCondition `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20020 struct { + Values []RestUserRateLimitSettings `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20021 struct { + Values []RestPullRequestSuggestion `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20022 struct { + Values []RestPullRequest `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20023 struct { + Values []string `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20024 struct { + Values []RestLabel `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20025 struct { + Values []RestLabelable `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20026 struct { + Values []RestJobMessage `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20027 struct { + Values []RestMigrationRepository `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20028 struct { + Values []RestMeshMigrationSummary `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20029 struct { + Values []RestRepository `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse2003 struct { + Values []RestMinimalRef `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20030 struct { + Values []RestProject `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20031 struct { + Values []RestHookScriptConfig `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20032 struct { + Values []RestPermittedUser `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20033 struct { + Values []RestBranch `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20034 struct { + Values []RestChange `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20035 struct { + Values []RestCommit `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20036 struct { + Values []RestComment `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20037 struct { + Values []RestDiff `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20038 struct { + //Values []Object `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20039 struct { + Values []RestPullRequestActivity `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse2004 struct { + Values []RestInsightReport `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20040 struct { + Values []RestPullRequestParticipant `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20041 struct { + Values []RestRepositoryRefChangeActivity `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20042 struct { + Values []RestSecretScanningAllowlistRule `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20043 struct { + Values []RestSecretScanningRule `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20044 struct { + Values []RestRepositoryHook `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20045 struct { + Values []RestReviewerGroup `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20046 struct { + Values []RestTag `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse20047 struct { + Values []RestProjectSettingsRestriction `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse2005 struct { + Values []RestApplicationUser `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse2006 struct { + Values []RestChangeset `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse2007 struct { + Values []RestGpgKey `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse2008 struct { + Values []RestMirrorRepositorySynchronizationStatus `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse2009 struct { + Values []RestUpstreamServer `json:"values,omitempty"` + Size float64 `json:"size,omitempty"` + Limit float64 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type InlineResponse401 struct { + Errors []RestErrorMessage `json:"errors,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type LatestKeysBody struct { + AlgorithmType string `json:"algorithmType,omitempty"` + BitLength int32 `json:"bitLength,omitempty"` + CreatedDate time.Time `json:"createdDate,omitempty"` + ExpiryDays int32 `json:"expiryDays,omitempty"` + Id int32 `json:"id,omitempty"` + Label string `json:"label,omitempty"` + LastAuthenticated string `json:"lastAuthenticated,omitempty"` + Text string `json:"text,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type MigrationMeshBody struct { + All bool `json:"all,omitempty"` + MaxBytesPerSecond *ApilatestmigrationmeshMaxBytesPerSecond `json:"maxBytesPerSecond,omitempty"` + ProjectIds []int32 `json:"projectIds,omitempty"` + RepositoryIds []int32 `json:"repositoryIds,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RepositoryHookDetails struct { + Version string `json:"version,omitempty"` + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + Type_ string `json:"type,omitempty"` + ConfigFormKey string `json:"configFormKey,omitempty"` + SupportedScopes []string `json:"supportedScopes,omitempty"` + Description string `json:"description,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestAccessToken struct { + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + CreatedDate time.Time `json:"createdDate,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestAccessTokenRequest struct { + ExpiryDays int32 `json:"expiryDays,omitempty"` + Name string `json:"name,omitempty"` + Permissions []string `json:"permissions,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestAggregateRejectCounter struct { + LastRejectTime float64 `json:"lastRejectTime,omitempty"` + RejectCount int64 `json:"rejectCount,omitempty"` + User *RestPullRequestParticipantUser `json:"user,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestAnalyticsSettings struct { + SupportEntitlementNumber string `json:"supportEntitlementNumber,omitempty"` + ServerTime int64 `json:"serverTime,omitempty"` + CanCollectAnalytics bool `json:"canCollectAnalytics,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestAnnouncementBanner struct { + Enabled bool `json:"enabled,omitempty"` + Message string `json:"message,omitempty"` + Audience string `json:"audience,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestApplicationProperties struct { + Version string `json:"version,omitempty"` + DisplayName string `json:"displayName,omitempty"` + BuildDate string `json:"buildDate,omitempty"` + BuildNumber string `json:"buildNumber,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestApplicationUser struct { + Name string `json:"name,omitempty"` + Id int32 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayName string `json:"displayName,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` + Slug string `json:"slug,omitempty"` + Links *interface{} `json:"links,omitempty"` + Active bool `json:"active,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestApplicationUserWithPermissions struct { + EffectivePermissions *interface{} `json:"effectivePermissions,omitempty"` + Id int32 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Slug string `json:"slug,omitempty"` + Active bool `json:"active,omitempty"` + Name string `json:"name,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` + Links *interface{} `json:"links,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestApplySuggestionRequest struct { + CommentVersion *RestApplySuggestionRequestCommentVersion `json:"commentVersion,omitempty"` + CommitMessage string `json:"commitMessage,omitempty"` + PullRequestVersion *RestApplySuggestionRequestPullRequestVersion `json:"pullRequestVersion,omitempty"` + SuggestionIndex *RestApplySuggestionRequestSuggestionIndex `json:"suggestionIndex,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestApplySuggestionRequestCommentVersion struct { + AsInt int32 `json:"asInt,omitempty"` + Present bool `json:"present,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestApplySuggestionRequestPullRequestVersion struct { + AsInt int32 `json:"asInt,omitempty"` + Present bool `json:"present,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestApplySuggestionRequestSuggestionIndex struct { + AsInt int32 `json:"asInt,omitempty"` + Present bool `json:"present,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestAttachmentMetadata struct { + Id int64 `json:"id,omitempty"` + Metadata string `json:"metadata,omitempty"` + Url string `json:"url,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestAuthenticationRequest struct { + Credentials *Credentials `json:"credentials"` + RepositoryId int32 `json:"repositoryId,omitempty"` + RequiredPermissionsOnly bool `json:"requiredPermissionsOnly,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestAutoDeclineSettings struct { + InactivityWeeks int32 `json:"inactivityWeeks,omitempty"` + Enabled bool `json:"enabled,omitempty"` + Scope *RestAutoDeclineSettingsScope `json:"scope,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestAutoDeclineSettingsRequest struct { + Enabled bool `json:"enabled,omitempty"` + InactivityWeeks int32 `json:"inactivityWeeks,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestAutoDeclineSettingsScope struct { + Type_ string `json:"type,omitempty"` + ResourceId int32 `json:"resourceId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBearerTokenCredentials struct { + Token string `json:"token"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBitbucketLicense struct { + NumberOfDaysBeforeExpiry int32 `json:"numberOfDaysBeforeExpiry,omitempty"` + NumberOfDaysBeforeGracePeriodExpiry int32 `json:"numberOfDaysBeforeGracePeriodExpiry,omitempty"` + NumberOfDaysBeforeMaintenanceExpiry int32 `json:"numberOfDaysBeforeMaintenanceExpiry,omitempty"` + SupportEntitlementNumber string `json:"supportEntitlementNumber,omitempty"` + UnlimitedNumberOfUsers bool `json:"unlimitedNumberOfUsers,omitempty"` + ServerId string `json:"serverId,omitempty"` + CreationDate int64 `json:"creationDate,omitempty"` + DaysBeforeExpiry int32 `json:"daysBeforeExpiry,omitempty"` + ExpiryDate int64 `json:"expiryDate,omitempty"` + GracePeriodEndDate int64 `json:"gracePeriodEndDate,omitempty"` + MaintenanceExpiryDate int64 `json:"maintenanceExpiryDate,omitempty"` + MaximumNumberOfUsers int32 `json:"maximumNumberOfUsers,omitempty"` + PurchaseDate int64 `json:"purchaseDate,omitempty"` + Status *RestBitbucketLicenseStatus `json:"status,omitempty"` + License string `json:"license,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBitbucketLicenseStatus struct { + ServerId string `json:"serverId,omitempty"` + CurrentNumberOfUsers int32 `json:"currentNumberOfUsers,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBranch struct { + Default_ bool `json:"default,omitempty"` + //Type_ *Object `json:"type,omitempty"` + DisplayId string `json:"displayId,omitempty"` + LatestChangeset string `json:"latestChangeset,omitempty"` + LatestCommit string `json:"latestCommit,omitempty"` + Id string `json:"id,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBranchCreateRequest struct { + // Name of the branch to be created + Name string `json:"name,omitempty"` + // Commit ID from which the branch is created + StartPoint string `json:"startPoint,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBranchDeleteRequest struct { + // Don't actually delete the ref name, just do a dry run + DryRun bool `json:"dryRun,omitempty"` + // Commit ID that the provided ref name is expected to point to + EndPoint string `json:"endPoint,omitempty"` + // Name of the ref to be deleted + Name string `json:"name,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBuildCapabilities struct { + BuildStatus []string `json:"buildStatus,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBuildStats struct { + Cancelled int32 `json:"cancelled,omitempty"` + Successful int32 `json:"successful,omitempty"` + InProgress int32 `json:"inProgress,omitempty"` + Failed int32 `json:"failed,omitempty"` + Unknown int32 `json:"unknown,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBuildStatus struct { + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + Parent string `json:"parent,omitempty"` + State string `json:"state,omitempty"` + Ref string `json:"ref,omitempty"` + TestResults *RestBuildStatusTestResults `json:"testResults,omitempty"` + BuildNumber string `json:"buildNumber,omitempty"` + Description string `json:"description,omitempty"` + Duration int64 `json:"duration,omitempty"` + UpdatedDate int64 `json:"updatedDate,omitempty"` + CreatedDate int64 `json:"createdDate,omitempty"` + Url string `json:"url,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBuildStatusSetRequest struct { + BuildNumber string `json:"buildNumber,omitempty"` + Description string `json:"description,omitempty"` + Duration int64 `json:"duration,omitempty"` + Key string `json:"key"` + LastUpdated int64 `json:"lastUpdated,omitempty"` + Name string `json:"name,omitempty"` + Parent string `json:"parent,omitempty"` + Ref string `json:"ref,omitempty"` + State string `json:"state"` + TestResults *RestBuildStatusSetRequestTestResults `json:"testResults,omitempty"` + Url string `json:"url"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBuildStatusSetRequestTestResults struct { + Failed int32 `json:"failed,omitempty"` + Skipped int32 `json:"skipped,omitempty"` + Successful int32 `json:"successful,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBuildStatusTestResults struct { + Skipped int32 `json:"skipped,omitempty"` + Successful int32 `json:"successful,omitempty"` + Failed int32 `json:"failed,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBulkAddInsightAnnotationRequest struct { + Annotations []RestSingleAddInsightAnnotationRequest `json:"annotations,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBulkUserRateLimitSettingsUpdateRequest struct { + Settings *RestBulkUserRateLimitSettingsUpdateRequestSettings `json:"settings,omitempty"` + Usernames []string `json:"usernames,omitempty"` + Whitelisted bool `json:"whitelisted,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestBulkUserRateLimitSettingsUpdateRequestSettings struct { + Capacity int32 `json:"capacity,omitempty"` + FillRate int32 `json:"fillRate,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestChange struct { + Type_ string `json:"type,omitempty"` + Path *RestCommentThreadDiffAnchorPath `json:"path,omitempty"` + Conflict *RestChangeConflict `json:"conflict,omitempty"` + ContentId string `json:"contentId,omitempty"` + FromContentId string `json:"fromContentId,omitempty"` + PercentUnchanged int32 `json:"percentUnchanged,omitempty"` + SrcExecutable bool `json:"srcExecutable,omitempty"` + NodeType string `json:"nodeType,omitempty"` + Executable bool `json:"executable,omitempty"` + SrcPath *RestCommentThreadDiffAnchorPath `json:"srcPath,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestChangeConflict struct { + TheirChange *RestChangeConflictTheirChange `json:"theirChange,omitempty"` + OurChange *RestChangeConflictTheirChange `json:"ourChange,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestChangeConflictTheirChange struct { + Type_ string `json:"type,omitempty"` + Path *RestCommentThreadDiffAnchorPath `json:"path,omitempty"` + SrcPath *RestCommentThreadDiffAnchorPath `json:"srcPath,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestChangeset struct { + FromCommit *RestChangesetFromCommit `json:"fromCommit,omitempty"` + ToCommit *RestChangesetToCommit `json:"toCommit,omitempty"` + Changes *RestChangesetChanges `json:"changes,omitempty"` + Repository *RestPullRequestFromRefRepository `json:"repository,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestChangesetChanges struct { + Values *interface{} `json:"values,omitempty"` + Size int32 `json:"size,omitempty"` + Limit int32 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestChangesetFromCommit struct { + Id string `json:"id,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestChangesetToCommit struct { + Message string `json:"message,omitempty"` + CommitterTimestamp int64 `json:"committerTimestamp,omitempty"` + Committer *RestChangesetToCommitCommitter `json:"committer,omitempty"` + AuthorTimestamp int64 `json:"authorTimestamp,omitempty"` + Parents []RestMinimalCommit `json:"parents,omitempty"` + Author *RestChangesetToCommitCommitter `json:"author,omitempty"` + Id string `json:"id,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestChangesetToCommitCommitter struct { + Name string `json:"name,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestClusterInformation struct { + LocalNode *RestClusterInformationLocalNode `json:"localNode,omitempty"` + Running bool `json:"running,omitempty"` + Nodes []RestClusterNode `json:"nodes,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestClusterInformationLocalNode struct { + Address *RestClusterNodeAddress `json:"address,omitempty"` + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + BuildVersion string `json:"buildVersion,omitempty"` + Local bool `json:"local,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestClusterNode struct { + Address *RestClusterNodeAddress `json:"address,omitempty"` + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + BuildVersion string `json:"buildVersion,omitempty"` + Local bool `json:"local,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestClusterNodeAddress struct { + Address string `json:"address,omitempty"` + Port int32 `json:"port,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestComment struct { + Version int32 `json:"version,omitempty"` + Parent *RestUserReactionCommentParent `json:"parent,omitempty"` + Id int64 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Comments []RestComment `json:"comments,omitempty"` + Severity string `json:"severity,omitempty"` + UpdatedDate int64 `json:"updatedDate,omitempty"` + ThreadResolvedDate int64 `json:"threadResolvedDate,omitempty"` + ThreadResolver *RestUserReactionCommentParentThreadResolver `json:"threadResolver,omitempty"` + Anchored bool `json:"anchored,omitempty"` + Pending bool `json:"pending,omitempty"` + // Indicates if this comment thread has been marked as resolved or not + ThreadResolved bool `json:"threadResolved,omitempty"` + Resolver *RestUserReactionCommentParentThreadResolver `json:"resolver,omitempty"` + ResolvedDate int64 `json:"resolvedDate,omitempty"` + Author *RestUserReactionCommentParentThreadResolver `json:"author,omitempty"` + CreatedDate int64 `json:"createdDate,omitempty"` + Anchor *RestUserReactionCommentParentAnchor `json:"anchor,omitempty"` + Html string `json:"html,omitempty"` + Reply bool `json:"reply,omitempty"` + Text string `json:"text,omitempty"` + Properties *interface{} `json:"properties,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestCommentJiraIssue struct { + CommentId int64 `json:"commentId,omitempty"` + IssueKey string `json:"issueKey,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestCommentThreadDiffAnchor struct { + Path *RestCommentThreadDiffAnchorPath `json:"path,omitempty"` + LineType string `json:"lineType,omitempty"` + FromHash string `json:"fromHash,omitempty"` + FileType string `json:"fileType,omitempty"` + DiffType string `json:"diffType,omitempty"` + PullRequest *RestCommentThreadDiffAnchorPullRequest `json:"pullRequest,omitempty"` + SrcPath *RestCommentThreadDiffAnchorPath `json:"srcPath,omitempty"` + ToHash string `json:"toHash,omitempty"` + LineComment bool `json:"lineComment,omitempty"` + Line int32 `json:"line,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestCommentThreadDiffAnchorPath struct { + Name string `json:"name,omitempty"` + Parent string `json:"parent,omitempty"` + Extension string `json:"extension,omitempty"` + Components []string `json:"components,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestCommentThreadDiffAnchorPullRequest struct { + Locked bool `json:"locked,omitempty"` + Version int32 `json:"version,omitempty"` + Id int64 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Open bool `json:"open,omitempty"` + Description string `json:"description,omitempty"` + ClosedDate int64 `json:"closedDate,omitempty"` + FromRef *RestPullRequestFromRef `json:"fromRef,omitempty"` + Participants []RestPullRequestParticipant `json:"participants,omitempty"` + Reviewers []RestPullRequestParticipant `json:"reviewers,omitempty"` + UpdatedDate int64 `json:"updatedDate,omitempty"` + HtmlDescription string `json:"htmlDescription,omitempty"` + CreatedDate int64 `json:"createdDate,omitempty"` + Closed bool `json:"closed,omitempty"` + Title string `json:"title,omitempty"` + ToRef *RestPullRequestFromRef `json:"toRef,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestCommit struct { + Message string `json:"message,omitempty"` + CommitterTimestamp int64 `json:"committerTimestamp,omitempty"` + Committer *RestChangesetToCommitCommitter `json:"committer,omitempty"` + AuthorTimestamp int64 `json:"authorTimestamp,omitempty"` + Parents []RestMinimalCommit `json:"parents,omitempty"` + Author *RestChangesetToCommitCommitter `json:"author,omitempty"` + Id string `json:"id,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestCommitMessageSuggestion struct { + Title string `json:"title,omitempty"` + Body string `json:"body,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestConflict struct { + TheirChange *RestChangeConflictTheirChange `json:"theirChange,omitempty"` + OurChange *RestChangeConflictTheirChange `json:"ourChange,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestConflictChange struct { + Type_ string `json:"type,omitempty"` + Path *RestCommentThreadDiffAnchorPath `json:"path,omitempty"` + SrcPath *RestCommentThreadDiffAnchorPath `json:"srcPath,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestConnectivitySummary struct { + RoundTripTime int64 `json:"roundTripTime,omitempty"` + Reachable bool `json:"reachable,omitempty"` + ErrorMessage string `json:"errorMessage,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestCreateBranchRequest struct { + Message string `json:"message,omitempty"` + Name string `json:"name,omitempty"` + StartPoint string `json:"startPoint,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestCreateTagRequest struct { + Message string `json:"message,omitempty"` + Name string `json:"name,omitempty"` + StartPoint string `json:"startPoint,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDefaultBranch struct { + Id string `json:"id,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDefaultReviewersRequest struct { + RequiredApprovals int32 `json:"requiredApprovals,omitempty"` + Reviewers []RestApplicationUser `json:"reviewers,omitempty"` + SourceMatcher *DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcher `json:"sourceMatcher,omitempty"` + TargetMatcher *DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcher `json:"targetMatcher,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDeployment struct { + Key string `json:"key,omitempty"` + State string `json:"state,omitempty"` + DisplayName string `json:"displayName,omitempty"` + DeploymentSequenceNumber int64 `json:"deploymentSequenceNumber,omitempty"` + FromCommit *RestChangesetFromCommit `json:"fromCommit,omitempty"` + ToCommit *RestChangesetFromCommit `json:"toCommit,omitempty"` + Repository *RestPullRequestFromRefRepository `json:"repository,omitempty"` + LastUpdated int64 `json:"lastUpdated,omitempty"` + Description string `json:"description,omitempty"` + Environment *RestDeploymentEnvironment `json:"environment,omitempty"` + Url string `json:"url,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDeploymentEnvironment struct { + Key string `json:"key"` + Type_ string `json:"type,omitempty"` + DisplayName string `json:"displayName"` + Url string `json:"url,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDeploymentSetRequest struct { + DeploymentSequenceNumber int64 `json:"deploymentSequenceNumber"` + Description string `json:"description"` + DisplayName string `json:"displayName"` + Environment *RestDeploymentEnvironment `json:"environment"` + Key string `json:"key"` + LastUpdated int64 `json:"lastUpdated,omitempty"` + State string `json:"state"` + Url string `json:"url"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDetailedGroup struct { + Name string `json:"name,omitempty"` + Deletable bool `json:"deletable,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDetailedInvocation struct { + Start int32 `json:"start,omitempty"` + Id int32 `json:"id,omitempty"` + Result *interface{} `json:"result,omitempty"` + EventScope *RestDetailedInvocationEventScope `json:"eventScope,omitempty"` + Request *interface{} `json:"request,omitempty"` + Duration int32 `json:"duration,omitempty"` + Finish int32 `json:"finish,omitempty"` + Event string `json:"event,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDetailedInvocationEventScope struct { + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDetailedUser struct { + LastAuthenticationTimestamp float64 `json:"lastAuthenticationTimestamp,omitempty"` + MutableDetails bool `json:"mutableDetails,omitempty"` + Deletable bool `json:"deletable,omitempty"` + MutableGroups bool `json:"mutableGroups,omitempty"` + DirectoryName string `json:"directoryName,omitempty"` + Name string `json:"name,omitempty"` + Id int32 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayName string `json:"displayName,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` + Slug string `json:"slug,omitempty"` + Links *interface{} `json:"links,omitempty"` + Active bool `json:"active,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDiff struct { + LineComments []RestComment `json:"lineComments,omitempty"` + Source *RestCommentThreadDiffAnchorPath `json:"source,omitempty"` + Destination *RestCommentThreadDiffAnchorPath `json:"destination,omitempty"` + Truncated bool `json:"truncated,omitempty"` + Binary bool `json:"binary,omitempty"` + Hunks []RestDiffHunk `json:"hunks,omitempty"` + Properties *interface{} `json:"properties,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDiffHunk struct { + Context string `json:"context,omitempty"` + SourceLine int32 `json:"sourceLine,omitempty"` + SourceSpan int32 `json:"sourceSpan,omitempty"` + DestinationLine int32 `json:"destinationLine,omitempty"` + DestinationSpan int32 `json:"destinationSpan,omitempty"` + Segments []RestDiffSegment `json:"segments,omitempty"` + Truncated bool `json:"truncated,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDiffLine struct { + ConflictMarker string `json:"conflictMarker,omitempty"` + CommentIds []int64 `json:"commentIds,omitempty"` + Source int32 `json:"source,omitempty"` + Destination int32 `json:"destination,omitempty"` + Truncated bool `json:"truncated,omitempty"` + Line string `json:"line,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestDiffSegment struct { + Type_ string `json:"type,omitempty"` + Truncated bool `json:"truncated,omitempty"` + Lines []RestDiffLine `json:"lines,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestEmoticon struct { + Value string `json:"value,omitempty"` + Shortcut string `json:"shortcut,omitempty"` + Url string `json:"url,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestEnhancedEntityLink struct { + ProjectName string `json:"projectName,omitempty"` + ApplicationLinkId string `json:"applicationLinkId,omitempty"` + DisplayUrl string `json:"displayUrl,omitempty"` + ProjectId int64 `json:"projectId,omitempty"` + ProjectKey string `json:"projectKey,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestErasedUser struct { + NewIdentifier string `json:"newIdentifier,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestErrorMessage struct { + Message string `json:"message,omitempty"` + Context string `json:"context,omitempty"` + ExceptionName string `json:"exceptionName,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestErrors struct { + Errors []RestErrorMessage `json:"errors,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestExportRequest struct { + ExportLocation string `json:"exportLocation,omitempty"` + RepositoriesRequest *RestExportRequestRepositoriesRequest `json:"repositoriesRequest"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestExportRequestRepositoriesRequest struct { + Includes []RestRepositorySelector `json:"includes"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestFarmSynchronizationRequest struct { + Attempt int32 `json:"attempt,omitempty"` + CreatedAt string `json:"createdAt,omitempty"` + ExternalRepoId string `json:"externalRepoId,omitempty"` + Type_ string `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestGitTagCreateRequest struct { + Force bool `json:"force,omitempty"` + Message string `json:"message,omitempty"` + Name string `json:"name,omitempty"` + StartPoint string `json:"startPoint,omitempty"` + Type_ string `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestGpgKey struct { + Id string `json:"id,omitempty"` + ExpiryDate int64 `json:"expiryDate,omitempty"` + SubKeys []RestGpgSubKey `json:"subKeys,omitempty"` + Fingerprint string `json:"fingerprint,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` + Text string `json:"text,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestGpgSubKey struct { + ExpiryDate time.Time `json:"expiryDate,omitempty"` + Fingerprint string `json:"fingerprint,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestHookScript struct { + Version int32 `json:"version,omitempty"` + Name string `json:"name,omitempty"` + Id int64 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + PluginKey string `json:"pluginKey,omitempty"` + Description string `json:"description,omitempty"` + UpdatedDate time.Time `json:"updatedDate,omitempty"` + CreatedDate time.Time `json:"createdDate,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestHookScriptConfig struct { + Script *RestHookScriptConfigScript `json:"script,omitempty"` + Scope *RestAutoDeclineSettingsScope `json:"scope,omitempty"` + TriggerIds []string `json:"triggerIds,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestHookScriptConfigScript struct { + Version int32 `json:"version,omitempty"` + Name string `json:"name,omitempty"` + Id int64 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + PluginKey string `json:"pluginKey,omitempty"` + Description string `json:"description,omitempty"` + UpdatedDate time.Time `json:"updatedDate,omitempty"` + CreatedDate time.Time `json:"createdDate,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestHookScriptTriggers struct { + TriggerIds []string `json:"triggerIds,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestImportRequest struct { + ArchivePath string `json:"archivePath,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestInsightAnnotation struct { + Message string `json:"message,omitempty"` + Type_ string `json:"type,omitempty"` + Path string `json:"path,omitempty"` + Severity string `json:"severity,omitempty"` + ReportKey string `json:"reportKey,omitempty"` + ExternalId string `json:"externalId,omitempty"` + Link string `json:"link,omitempty"` + Line int32 `json:"line,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestInsightAnnotationsResponse struct { + Annotations []RestInsightAnnotation `json:"annotations,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestInsightReport struct { + Key string `json:"key,omitempty"` + Result string `json:"result,omitempty"` + CreatedDate float64 `json:"createdDate,omitempty"` + Reporter string `json:"reporter,omitempty"` + Details string `json:"details,omitempty"` + LogoUrl string `json:"logoUrl,omitempty"` + Link string `json:"link,omitempty"` + Title string `json:"title,omitempty"` + Data []RestInsightReportData `json:"data,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestInsightReportData struct { + Value *interface{} `json:"value,omitempty"` + Type_ string `json:"type,omitempty"` + Title string `json:"title,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestJiraIssue struct { + Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestJob struct { + Progress *RestJobProgress `json:"progress,omitempty"` + Id int64 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Type_ string `json:"type,omitempty"` + EndDate int64 `json:"endDate,omitempty"` + StartDate int64 `json:"startDate,omitempty"` + NodeId string `json:"nodeId,omitempty"` + Initiator *RestPullRequestParticipantUser `json:"initiator,omitempty"` + UpdatedDate int64 `json:"updatedDate,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestJobMessage struct { + Subject string `json:"subject,omitempty"` + Id string `json:"id,omitempty"` + Severity string `json:"severity,omitempty"` + CreatedDate time.Time `json:"createdDate,omitempty"` + Text string `json:"text,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestJobProgress struct { + Message string `json:"message,omitempty"` + Percentage int32 `json:"percentage,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestLabel struct { + Name string `json:"name,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestLabelable struct { + LabelableType string `json:"labelableType,omitempty"` + Name string `json:"name,omitempty"` + Id int32 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Public bool `json:"public,omitempty"` + Project *RestPullRequestFromRefRepositoryProject `json:"project,omitempty"` + Description string `json:"description,omitempty"` + DefaultBranch string `json:"defaultBranch,omitempty"` + RelatedLinks *interface{} `json:"relatedLinks,omitempty"` + Partition int32 `json:"partition,omitempty"` + Origin *RestPullRequestFromRefRepositoryOrigin `json:"origin,omitempty"` + HierarchyId string `json:"hierarchyId,omitempty"` + StatusMessage string `json:"statusMessage,omitempty"` + Archived bool `json:"archived,omitempty"` + Forkable bool `json:"forkable,omitempty"` + ScmId string `json:"scmId,omitempty"` + Slug string `json:"slug,omitempty"` + Scope string `json:"scope,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestLogLevel struct { + LogLevel string `json:"logLevel,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMailConfiguration struct { + Protocol string `json:"protocol,omitempty"` + Port int32 `json:"port,omitempty"` + Hostname string `json:"hostname,omitempty"` + RequireStartTls bool `json:"requireStartTls,omitempty"` + UseStartTls bool `json:"useStartTls,omitempty"` + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + SenderAddress string `json:"senderAddress,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMarkup struct { + Html string `json:"html,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMeshConnectivityReport struct { + Reports []RestNodeConnectivityReport `json:"reports,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMeshMigrationRequest struct { + All bool `json:"all,omitempty"` + MaxBytesPerSecond *ApilatestmigrationmeshMaxBytesPerSecond `json:"maxBytesPerSecond,omitempty"` + ProjectIds []int32 `json:"projectIds,omitempty"` + RepositoryIds []int32 `json:"repositoryIds,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMeshMigrationSummary struct { + Progress int32 `json:"progress,omitempty"` + Queue *interface{} `json:"queue,omitempty"` + State string `json:"state,omitempty"` + StartTime int64 `json:"startTime,omitempty"` + EndTime int64 `json:"endTime,omitempty"` + MaxBandwidth int64 `json:"maxBandwidth,omitempty"` + JobId int64 `json:"jobId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMeshNode struct { + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + State string `json:"state,omitempty"` + RpcUrl string `json:"rpcUrl,omitempty"` + LastSeenDate float64 `json:"lastSeenDate,omitempty"` + Offline bool `json:"offline,omitempty"` + RpcId string `json:"rpcId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMigrationRepository struct { + MigrationState string `json:"migrationState,omitempty"` + Repository *RestPullRequestFromRefRepository `json:"repository,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMinimalCommit struct { + Id string `json:"id,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMinimalRef struct { + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMirrorHashes struct { + Content string `json:"content,omitempty"` + Metadata string `json:"metadata,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMirrorRepositorySynchronizationStatus struct { + ExternalRepoId string `json:"externalRepoId,omitempty"` + FailedSyncCount int32 `json:"failedSyncCount,omitempty"` + Hashes *RestMirrorRepositorySynchronizationStatusHashes `json:"hashes,omitempty"` + LastSyncDate time.Time `json:"lastSyncDate,omitempty"` + LocalProjectId int32 `json:"localProjectId,omitempty"` + LocalRepoId int32 `json:"localRepoId,omitempty"` + UpstreamId string `json:"upstreamId,omitempty"` + InitialSyncDate time.Time `json:"initialSyncDate,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMirrorRepositorySynchronizationStatusHashes struct { + Content string `json:"content,omitempty"` + Metadata string `json:"metadata,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMirrorServer struct { + Enabled bool `json:"enabled,omitempty"` + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + ProductType string `json:"productType,omitempty"` + ProductVersion string `json:"productVersion,omitempty"` + MirrorType string `json:"mirrorType,omitempty"` + LastSeenDate time.Time `json:"lastSeenDate,omitempty"` + BaseUrl string `json:"baseUrl,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMirrorUpgradeRequest struct { + AddonDescriptorUri string `json:"addonDescriptorUri,omitempty"` + BaseUrl string `json:"baseUrl,omitempty"` + ProductType string `json:"productType,omitempty"` + ProductVersion string `json:"productVersion,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMirroredRepository struct { + Available bool `json:"available,omitempty"` + RepositoryId string `json:"repositoryId,omitempty"` + Status string `json:"status,omitempty"` + LastUpdated time.Time `json:"lastUpdated,omitempty"` + MirrorName string `json:"mirrorName,omitempty"` + CloneUrls []RestNamedLink `json:"cloneUrls,omitempty"` + PushUrls []RestNamedLink `json:"pushUrls,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMirroredRepositoryDescriptor struct { + MirrorServer *RestMirroredRepositoryDescriptorMirrorServer `json:"mirrorServer,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMirroredRepositoryDescriptorMirrorServer struct { + Enabled bool `json:"enabled,omitempty"` + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + ProductType string `json:"productType,omitempty"` + ProductVersion string `json:"productVersion,omitempty"` + MirrorType string `json:"mirrorType,omitempty"` + LastSeenDate time.Time `json:"lastSeenDate"` + BaseUrl string `json:"baseUrl,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestMirroringRequest struct { + Id int32 `json:"id,omitempty"` + State string `json:"state,omitempty"` + ProductType string `json:"productType,omitempty"` + ProductVersion string `json:"productVersion,omitempty"` + MirrorType string `json:"mirrorType,omitempty"` + MirrorName string `json:"mirrorName,omitempty"` + MirrorBaseUrl string `json:"mirrorBaseUrl,omitempty"` + AddonDescriptorUri string `json:"addonDescriptorUri,omitempty"` + MirrorId string `json:"mirrorId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestNamedLink struct { + Name string `json:"name,omitempty"` + Href string `json:"href,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestNode struct { + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestNodeConnectivityReport struct { + Node *RestNodeConnectivityReportNode `json:"node,omitempty"` + Summaries []RestNodeConnectivitySummary `json:"summaries,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestNodeConnectivityReportNode struct { + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestNodeConnectivitySummary struct { + Node *RestNodeConnectivityReportNode `json:"node,omitempty"` + Summary *RestNodeConnectivitySummarySummary `json:"summary,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestNodeConnectivitySummarySummary struct { + RoundTripTime int64 `json:"roundTripTime,omitempty"` + Reachable bool `json:"reachable,omitempty"` + ErrorMessage string `json:"errorMessage,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPageRestChange struct { + Values *interface{} `json:"values,omitempty"` + Size int32 `json:"size,omitempty"` + Limit int32 `json:"limit,omitempty"` + IsLastPage bool `json:"isLastPage,omitempty"` + NextPageStart int32 `json:"nextPageStart,omitempty"` + Start int32 `json:"start,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPath struct { + Name string `json:"name,omitempty"` + Parent string `json:"parent,omitempty"` + Extension string `json:"extension,omitempty"` + Components []string `json:"components,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPermitted struct { + Permitted bool `json:"permitted,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPermittedGroup struct { + Permission string `json:"permission,omitempty"` + Group *RestPermittedGroupGroup `json:"group,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPermittedGroupGroup struct { + Name string `json:"name,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPermittedUser struct { + Permission string `json:"permission,omitempty"` + User *RestPullRequestParticipantUser `json:"user,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPerson struct { + Name string `json:"name,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestProgress struct { + Message string `json:"message,omitempty"` + Percentage int32 `json:"percentage,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestProject struct { + Name string `json:"name,omitempty"` + Key string `json:"key,omitempty"` + Id int32 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + Public bool `json:"public,omitempty"` + Description string `json:"description,omitempty"` + Namespace string `json:"namespace,omitempty"` + Avatar string `json:"avatar,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` + Scope string `json:"scope,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestProjectSettingsRestriction struct { + ComponentKey string `json:"componentKey,omitempty"` + ProcessedState string `json:"processedState,omitempty"` + Project *RestPullRequestFromRefRepositoryProject `json:"project,omitempty"` + Namespace string `json:"namespace,omitempty"` + FeatureKey string `json:"featureKey,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestProjectSettingsRestrictionRequest struct { + ComponentKey string `json:"componentKey,omitempty"` + FeatureKey string `json:"featureKey"` + Namespace string `json:"namespace"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestProperties struct { + ContentHash string `json:"contentHash,omitempty"` + MetadataHash string `json:"metadataHash,omitempty"` + DefaultBranchId string `json:"defaultBranchId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequest struct { + Locked bool `json:"locked,omitempty"` + Version int32 `json:"version,omitempty"` + Id int64 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Open bool `json:"open,omitempty"` + Description string `json:"description,omitempty"` + ClosedDate int64 `json:"closedDate,omitempty"` + FromRef *RestPullRequestFromRef `json:"fromRef,omitempty"` + Participants []RestPullRequestParticipant `json:"participants,omitempty"` + Reviewers []RestPullRequestParticipant `json:"reviewers,omitempty"` + UpdatedDate int64 `json:"updatedDate,omitempty"` + HtmlDescription string `json:"htmlDescription,omitempty"` + CreatedDate int64 `json:"createdDate,omitempty"` + Closed bool `json:"closed,omitempty"` + Title string `json:"title,omitempty"` + ToRef *RestPullRequestFromRef `json:"toRef,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestActivity struct { + Action string `json:"action,omitempty"` + Id int64 `json:"id,omitempty"` + CreatedDate int64 `json:"createdDate,omitempty"` + User *RestPullRequestParticipantUser `json:"user,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestAssignParticipantRoleRequest struct { + Role string `json:"role,omitempty"` + User *RestPullRequestAssignParticipantRoleRequestUser `json:"user,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestAssignParticipantRoleRequestUser struct { + Active bool `json:"active,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` + DisplayName string `json:"displayName,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` + Id int32 `json:"id,omitempty"` + Links *interface{} `json:"links,omitempty"` + Name string `json:"name,omitempty"` + Slug string `json:"slug,omitempty"` + Type_ string `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestAssignStatusRequest struct { + Status string `json:"status,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestAutoMergeRequest struct { + AutoSubject string `json:"autoSubject,omitempty"` + Message string `json:"message,omitempty"` + StrategyId string `json:"strategyId,omitempty"` + Version int32 `json:"version,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestCommitMessageTemplate struct { + Title string `json:"title,omitempty"` + Body string `json:"body,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestCondition struct { + Id int32 `json:"id,omitempty"` + RequiredApprovals int32 `json:"requiredApprovals,omitempty"` + SourceRefMatcher *RestRequiredBuildConditionRefMatcher `json:"sourceRefMatcher,omitempty"` + TargetRefMatcher *RestRequiredBuildConditionRefMatcher `json:"targetRefMatcher,omitempty"` + Reviewers []RestApplicationUser `json:"reviewers,omitempty"` + Scope *RestPullRequestConditionScope `json:"scope,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestConditionScope struct { + Type_ string `json:"type,omitempty"` + ResourceId int32 `json:"resourceId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestDeclineRequest struct { + Comment string `json:"comment,omitempty"` + Version int32 `json:"version,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestDeleteRequest struct { + Version int32 `json:"version,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestFinishReviewRequest struct { + CommentText string `json:"commentText,omitempty"` + ParticipantStatus string `json:"participantStatus,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestFromRef struct { + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + Repository *RestPullRequestFromRefRepository `json:"repository,omitempty"` + DisplayId string `json:"displayId,omitempty"` + LatestCommit string `json:"latestCommit,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestFromRefRepository struct { + Name string `json:"name,omitempty"` + Id int32 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Public bool `json:"public,omitempty"` + Project *RestPullRequestFromRefRepositoryProject `json:"project,omitempty"` + Description string `json:"description,omitempty"` + DefaultBranch string `json:"defaultBranch,omitempty"` + RelatedLinks *interface{} `json:"relatedLinks,omitempty"` + Partition int32 `json:"partition,omitempty"` + Origin *RestPullRequestFromRefRepositoryOrigin `json:"origin,omitempty"` + HierarchyId string `json:"hierarchyId,omitempty"` + StatusMessage string `json:"statusMessage,omitempty"` + Archived bool `json:"archived,omitempty"` + Forkable bool `json:"forkable,omitempty"` + ScmId string `json:"scmId,omitempty"` + Slug string `json:"slug,omitempty"` + Scope string `json:"scope,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestFromRefRepositoryOrigin struct { + Name string `json:"name,omitempty"` + Id int32 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Public bool `json:"public,omitempty"` + Project *RestPullRequestFromRefRepositoryProject `json:"project,omitempty"` + Description string `json:"description,omitempty"` + DefaultBranch string `json:"defaultBranch,omitempty"` + RelatedLinks *interface{} `json:"relatedLinks,omitempty"` + Partition int32 `json:"partition,omitempty"` + HierarchyId string `json:"hierarchyId,omitempty"` + StatusMessage string `json:"statusMessage,omitempty"` + Archived bool `json:"archived,omitempty"` + Forkable bool `json:"forkable,omitempty"` + ScmId string `json:"scmId,omitempty"` + Slug string `json:"slug,omitempty"` + Scope string `json:"scope,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestFromRefRepositoryProject struct { + Name string `json:"name,omitempty"` + Key string `json:"key"` + Id int32 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + Public bool `json:"public,omitempty"` + Description string `json:"description,omitempty"` + Namespace string `json:"namespace,omitempty"` + Avatar string `json:"avatar,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` + Scope string `json:"scope,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestMergeConfig struct { + Type_ string `json:"type,omitempty"` + CommitMessageTemplate *RestPullRequestMergeConfigCommitMessageTemplate `json:"commitMessageTemplate,omitempty"` + CommitSummaries int32 `json:"commitSummaries,omitempty"` + DefaultStrategy *RestPullRequestMergeConfigDefaultStrategy `json:"defaultStrategy,omitempty"` + Strategies []RestPullRequestMergeStrategy `json:"strategies,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestMergeConfigCommitMessageTemplate struct { + Title string `json:"title,omitempty"` + Body string `json:"body,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestMergeConfigDefaultStrategy struct { + Enabled bool `json:"enabled,omitempty"` + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + Description string `json:"description,omitempty"` + Flag string `json:"flag,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestMergeRequest struct { + AutoSubject string `json:"autoSubject,omitempty"` + Message string `json:"message,omitempty"` + StrategyId string `json:"strategyId,omitempty"` + Version int32 `json:"version,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestMergeStrategy struct { + Enabled bool `json:"enabled,omitempty"` + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + Description string `json:"description,omitempty"` + Flag string `json:"flag,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestMergeability struct { + Outcome string `json:"outcome,omitempty"` + Vetoes []RestRepositoryHookVeto `json:"vetoes,omitempty"` + Conflicted bool `json:"conflicted,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestParticipant struct { + Status string `json:"status,omitempty"` + LastReviewedCommit string `json:"lastReviewedCommit,omitempty"` + Approved bool `json:"approved,omitempty"` + Role string `json:"role,omitempty"` + User *RestPullRequestParticipantUser `json:"user,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestParticipantUser struct { + Name string `json:"name,omitempty"` + Id int32 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayName string `json:"displayName,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` + Slug string `json:"slug,omitempty"` + Links *interface{} `json:"links,omitempty"` + Active bool `json:"active,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestRebaseRequest struct { + Version int32 `json:"version,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestRebaseResult struct { + RefChange *RestPullRequestRebaseResultRefChange `json:"refChange,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestRebaseResultRefChange struct { + Type_ string `json:"type,omitempty"` + Ref *RestPullRequestRebaseResultRefChangeRef `json:"ref,omitempty"` + FromHash string `json:"fromHash,omitempty"` + ToHash string `json:"toHash,omitempty"` + RefId string `json:"refId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestRebaseResultRefChangeRef struct { + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestRebaseability struct { + Vetoes []RestRepositoryHookVeto `json:"vetoes,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestRef struct { + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + Repository *RestPullRequestFromRefRepository `json:"repository,omitempty"` + DisplayId string `json:"displayId,omitempty"` + LatestCommit string `json:"latestCommit,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestReopenRequest struct { + Version int32 `json:"version,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestSettings struct { + MergeConfig *RestPullRequestSettingsMergeConfig `json:"mergeConfig,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestSettingsMergeConfig struct { + Type_ string `json:"type,omitempty"` + CommitMessageTemplate *RestPullRequestMergeConfigCommitMessageTemplate `json:"commitMessageTemplate,omitempty"` + CommitSummaries int32 `json:"commitSummaries,omitempty"` + DefaultStrategy *RestPullRequestMergeConfigDefaultStrategy `json:"defaultStrategy,omitempty"` + Strategies []RestPullRequestMergeStrategy `json:"strategies,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPullRequestSuggestion struct { + ChangeTme int64 `json:"changeTme,omitempty"` + RefChange *RestPullRequestRebaseResultRefChange `json:"refChange,omitempty"` + Repository *RestPullRequestFromRefRepository `json:"repository,omitempty"` + FromRef *RestPullRequestRebaseResultRefChangeRef `json:"fromRef,omitempty"` + ToRef *RestPullRequestRebaseResultRefChangeRef `json:"toRef,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestPushRefChange struct { + UpdatedType string `json:"updatedType,omitempty"` + Type_ string `json:"type,omitempty"` + Ref *RestPullRequestRebaseResultRefChangeRef `json:"ref,omitempty"` + FromHash string `json:"fromHash,omitempty"` + ToHash string `json:"toHash,omitempty"` + RefId string `json:"refId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRateLimitSettings struct { + DefaultSettings *RestBulkUserRateLimitSettingsUpdateRequestSettings `json:"defaultSettings,omitempty"` + Enabled bool `json:"enabled,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRawAccessToken struct { + Token string `json:"token,omitempty"` + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` + CreatedDate time.Time `json:"createdDate,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRefChange struct { + Type_ string `json:"type,omitempty"` + Ref *RestPullRequestRebaseResultRefChangeRef `json:"ref,omitempty"` + FromHash string `json:"fromHash,omitempty"` + ToHash string `json:"toHash,omitempty"` + RefId string `json:"refId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRefMatcher struct { + Id string `json:"id,omitempty"` + Type_ *RestRefMatcherType `json:"type,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRefMatcherType struct { + Name string `json:"name,omitempty"` + Id string `json:"id,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRefRestriction struct { + Id int32 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + Groups []string `json:"groups,omitempty"` + AccessKeys []RestSshAccessKey `json:"accessKeys,omitempty"` + Matcher *RestRequiredBuildConditionRefMatcher `json:"matcher,omitempty"` + Scope *RestPullRequestConditionScope `json:"scope,omitempty"` + Users []RestApplicationUser `json:"users,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRefSyncQueue struct { + Values []RestFarmSynchronizationRequest `json:"values,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRefSyncRequest struct { + Action string `json:"action,omitempty"` + Context *Context `json:"context,omitempty"` + RefId string `json:"refId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRefSyncStatus struct { + Enabled bool `json:"enabled,omitempty"` + Available bool `json:"available,omitempty"` + OrphanedRefs *RestRefSyncStatusOrphanedRefs `json:"orphanedRefs,omitempty"` + LastSync float64 `json:"lastSync,omitempty"` + DivergedRefs *RestRefSyncStatusOrphanedRefs `json:"divergedRefs,omitempty"` + AheadRefs *RestRefSyncStatusOrphanedRefs `json:"aheadRefs,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRefSyncStatusOrphanedRefs struct { + State string `json:"state,omitempty"` + Tag bool `json:"tag,omitempty"` + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRejectedRef struct { + State string `json:"state,omitempty"` + Tag bool `json:"tag,omitempty"` + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepositoriesExportRequest struct { + Includes []RestRepositorySelector `json:"includes"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepository struct { + Name string `json:"name,omitempty"` + Id int32 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Public bool `json:"public,omitempty"` + Project *RestPullRequestFromRefRepositoryProject `json:"project,omitempty"` + Description string `json:"description,omitempty"` + DefaultBranch string `json:"defaultBranch,omitempty"` + RelatedLinks *interface{} `json:"relatedLinks,omitempty"` + Partition int32 `json:"partition,omitempty"` + Origin *RestPullRequestFromRefRepositoryOrigin `json:"origin,omitempty"` + HierarchyId string `json:"hierarchyId,omitempty"` + StatusMessage string `json:"statusMessage,omitempty"` + Archived bool `json:"archived,omitempty"` + Forkable bool `json:"forkable,omitempty"` + ScmId string `json:"scmId,omitempty"` + Slug string `json:"slug,omitempty"` + Scope string `json:"scope,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepositoryHook struct { + Enabled bool `json:"enabled,omitempty"` + Configured bool `json:"configured,omitempty"` + Details *RepositoryHookDetails `json:"details,omitempty"` + Scope *RestAutoDeclineSettingsScope `json:"scope,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepositoryHookVeto struct { + SummaryMessage string `json:"summaryMessage,omitempty"` + DetailedMessage string `json:"detailedMessage,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepositoryMirrorEvent struct { + MirrorRepoId int32 `json:"mirrorRepoId,omitempty"` + Type_ string `json:"type,omitempty"` + UpstreamRepoId string `json:"upstreamRepoId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepositoryPolicy struct { + // The permission required to delete repositories. Must be one of: \"SYS_ADMIN\", \"ADMIN\", \"PROJECT_ADMIN\", \"REPO_ADMIN\". + Permission string `json:"permission,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepositoryPullRequestSettings struct { + RequiredAllTasksComplete bool `json:"requiredAllTasksComplete,omitempty"` + RequiredApproversDeprecated int32 `json:"requiredApproversDeprecated,omitempty"` + RequiredSuccessfulBuilds *RestRepositoryPullRequestSettingsRequiredSuccessfulBuilds `json:"requiredSuccessfulBuilds,omitempty"` + RequiredSuccessfulBuildsDeprecated int32 `json:"requiredSuccessfulBuildsDeprecated,omitempty"` + RequiredAllApprovers bool `json:"requiredAllApprovers,omitempty"` + RequiredApprovers *RestRepositoryPullRequestSettingsRequiredSuccessfulBuilds `json:"requiredApprovers,omitempty"` + MergeConfig *RestPullRequestSettingsMergeConfig `json:"mergeConfig,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepositoryPullRequestSettingsRequiredSuccessfulBuilds struct { + Enabled bool `json:"enabled,omitempty"` + Count string `json:"count,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepositoryRefChangeActivity struct { + RefChange *RestRepositoryRefChangeActivityRefChange `json:"refChange,omitempty"` + Trigger string `json:"trigger,omitempty"` + Repository *RestPullRequestFromRefRepository `json:"repository,omitempty"` + Id int64 `json:"id,omitempty"` + CreatedDate int64 `json:"createdDate,omitempty"` + User *RestPullRequestParticipantUser `json:"user,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepositoryRefChangeActivityRefChange struct { + UpdatedType string `json:"updatedType,omitempty"` + Type_ string `json:"type,omitempty"` + Ref *RestPullRequestRebaseResultRefChangeRef `json:"ref,omitempty"` + FromHash string `json:"fromHash,omitempty"` + ToHash string `json:"toHash,omitempty"` + RefId string `json:"refId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRepositorySelector struct { + ProjectKey string `json:"projectKey,omitempty"` + Slug string `json:"slug,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRequiredBuildCondition struct { + Id int64 `json:"id,omitempty"` + // A non-empty list of build parent keys that require green builds for this merge check to pass + BuildParentKeys []string `json:"buildParentKeys,omitempty"` + RefMatcher *RestRequiredBuildConditionRefMatcher `json:"refMatcher,omitempty"` + ExemptRefMatcher *RestRequiredBuildConditionRefMatcher `json:"exemptRefMatcher,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRequiredBuildConditionRefMatcher struct { + Id string `json:"id,omitempty"` + Type_ *RestRefMatcherType `json:"type,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRequiredBuildConditionSetRequest struct { + // A non-empty list of build parent keys that require green builds for this merge check to pass + BuildParentKeys []string `json:"buildParentKeys"` + ExemptRefMatcher *RestRefMatcher `json:"exemptRefMatcher,omitempty"` + RefMatcher *DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcher `json:"refMatcher"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRestrictionRequest struct { + AccessKeyIds []int32 `json:"accessKeyIds,omitempty"` + AccessKeys []RestSshAccessKey `json:"accessKeys,omitempty"` + GroupNames []string `json:"groupNames,omitempty"` + Groups []string `json:"groups,omitempty"` + Id int32 `json:"id,omitempty"` + Matcher *DefaultreviewerslatestprojectsprojectKeyreposrepositorySlugconditionidSourceMatcher `json:"matcher,omitempty"` + Scope *RestRestrictionRequestScope `json:"scope,omitempty"` + Type_ string `json:"type,omitempty"` + UserSlugs []string `json:"userSlugs,omitempty"` + Users []RestApplicationUser `json:"users,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestRestrictionRequestScope struct { + ResourceId int32 `json:"resourceId,omitempty"` + Type_ string `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestReviewerGroup struct { + Name string `json:"name,omitempty"` + Id int64 `json:"id,omitempty"` + Description string `json:"description,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` + Scope *RestAutoDeclineSettingsScope `json:"scope,omitempty"` + Users []ApplicationUser `json:"users,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestScope struct { + Type_ string `json:"type,omitempty"` + ResourceId int32 `json:"resourceId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestScopesExample struct { + Scopes []interface{} `json:"scopes,omitempty"` + Links *interface{} `json:"links,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSecretScanningAllowlistRule struct { + // Human readable name for the rule + Name string `json:"name,omitempty"` + // The ID of the rule + Id int64 `json:"id,omitempty"` + // If present, regular expression for matching a secret on a code line + LineRegex string `json:"lineRegex,omitempty"` + // If present, regular expression matching file names + PathRegex string `json:"pathRegex,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSecretScanningAllowlistRuleSetRequest struct { + // Regular expression for matching a secret on a code line + LineRegex string `json:"lineRegex,omitempty"` + // Human readable name for the rule + Name string `json:"name,omitempty"` + // Regular expression matching file names + PathRegex string `json:"pathRegex,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSecretScanningRule struct { + // Human readable name for the rule + Name string `json:"name,omitempty"` + // The ID of the rule + Id int64 `json:"id,omitempty"` + // If present, regular expression for matching a secret on a code line + LineRegex string `json:"lineRegex,omitempty"` + // If present, regular expression matching file names + PathRegex string `json:"pathRegex,omitempty"` + Scope *RestSecretScanningRuleScope `json:"scope,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +// The scope in which this rule was configured for. +type RestSecretScanningRuleScope struct { + Type_ string `json:"type,omitempty"` + ResourceId int32 `json:"resourceId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSecretScanningRuleSetRequest struct { + // Regular expression for matching a secret on a code line + LineRegex string `json:"lineRegex,omitempty"` + // Human readable name for the rule + Name string `json:"name,omitempty"` + // Regular expression matching file names + PathRegex string `json:"pathRegex,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSetInsightReportRequest struct { + CoverageProviderKey string `json:"coverageProviderKey,omitempty"` + CreatedDate int64 `json:"createdDate,omitempty"` + Data []RestInsightReportData `json:"data"` + Details string `json:"details,omitempty"` + Link string `json:"link,omitempty"` + LogoUrl string `json:"logoUrl,omitempty"` + Reporter string `json:"reporter,omitempty"` + Result string `json:"result,omitempty"` + Title string `json:"title"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSingleAddInsightAnnotationRequest struct { + ExternalId string `json:"externalId,omitempty"` + Line int32 `json:"line,omitempty"` + Link string `json:"link,omitempty"` + Message string `json:"message"` + Path string `json:"path,omitempty"` + Severity string `json:"severity"` + Type_ string `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSshAccessKey struct { + Key *RestSshAccessKeyKey `json:"key,omitempty"` + Permission string `json:"permission,omitempty"` + Repository *RestPullRequestFromRefRepository `json:"repository,omitempty"` + Project *RestPullRequestFromRefRepositoryProject `json:"project,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSshAccessKeyKey struct { + Id int32 `json:"id,omitempty"` + LastAuthenticated string `json:"lastAuthenticated,omitempty"` + CreatedDate time.Time `json:"createdDate,omitempty"` + BitLength int32 `json:"bitLength,omitempty"` + AlgorithmType string `json:"algorithmType,omitempty"` + ExpiryDays int32 `json:"expiryDays,omitempty"` + Label string `json:"label,omitempty"` + Text string `json:"text,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSshAccessKeyLocations struct { + Projects *RestProject `json:"projects,omitempty"` + Repositories *RestRepository `json:"repositories,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSshCredentials struct { + // The key algorithm, if passing in a legacy X.509 encoded key. Do not specify for OpenSSH encoded keys + Algorithm string `json:"algorithm,omitempty"` + // The public key text in the OpenSSH format. The algorithm must be specified in case of the legacy X.509 keys + PublicKey string `json:"publicKey"` + Username string `json:"username,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSshKey struct { + Id int32 `json:"id,omitempty"` + LastAuthenticated string `json:"lastAuthenticated,omitempty"` + CreatedDate time.Time `json:"createdDate,omitempty"` + BitLength int32 `json:"bitLength,omitempty"` + AlgorithmType string `json:"algorithmType,omitempty"` + ExpiryDays int32 `json:"expiryDays,omitempty"` + Label string `json:"label,omitempty"` + Text string `json:"text,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSshKeySettings struct { + KeyTypeRestrictions []RestSshKeyTypeRestriction `json:"keyTypeRestrictions,omitempty"` + MaxExpiryDays *RestSshKeySettingsMaxExpiryDays `json:"maxExpiryDays,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSshKeySettingsMaxExpiryDays struct { + AsInt int32 `json:"asInt,omitempty"` + Present bool `json:"present,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSshKeyTypeRestriction struct { + Algorithm string `json:"algorithm,omitempty"` + Allowed bool `json:"allowed,omitempty"` + MinKeyLength *RestSshKeyTypeRestrictionMinKeyLength `json:"minKeyLength,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSshKeyTypeRestrictionMinKeyLength struct { + AsInt int32 `json:"asInt,omitempty"` + Present bool `json:"present,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSshSettings struct { + Enabled bool `json:"enabled,omitempty"` + Port int32 `json:"port,omitempty"` + BaseUrl string `json:"baseUrl,omitempty"` + Fingerprint *SimpleSshKeyFingerprint `json:"fingerprint,omitempty"` + AccessKeysEnabled bool `json:"accessKeysEnabled,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestSyncProgress struct { + SyncedRepos int32 `json:"syncedRepos,omitempty"` + Discovering bool `json:"discovering,omitempty"` + TotalRepos int32 `json:"totalRepos,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestTag struct { + Hash string `json:"hash,omitempty"` + LatestChangeset string `json:"latestChangeset,omitempty"` + LatestCommit string `json:"latestCommit,omitempty"` + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayId string `json:"displayId,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestTestResults struct { + Skipped int32 `json:"skipped,omitempty"` + Successful int32 `json:"successful,omitempty"` + Failed int32 `json:"failed,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestTokenBucketSettings struct { + Capacity int32 `json:"capacity,omitempty"` + FillRate int32 `json:"fillRate,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUpstreamServer struct { + Id string `json:"id,omitempty"` + State string `json:"state,omitempty"` + Type_ string `json:"type,omitempty"` + ApiBaseUrl string `json:"apiBaseUrl,omitempty"` + BaseUrl string `json:"baseUrl,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUpstreamSettings struct { + ProjectIds []string `json:"projectIds,omitempty"` + Mode string `json:"mode,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUserDirectory struct { + Name string `json:"name,omitempty"` + Type_ string `json:"type,omitempty"` + Description string `json:"description,omitempty"` + Active bool `json:"active,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUserRateLimitSettings struct { + Whitelisted bool `json:"whitelisted,omitempty"` + Settings *RestBulkUserRateLimitSettingsUpdateRequestSettings `json:"settings,omitempty"` + User *RestPullRequestParticipantUser `json:"user,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUserRateLimitSettingsUpdateRequest struct { + Settings *RestBulkUserRateLimitSettingsUpdateRequestSettings `json:"settings,omitempty"` + Whitelisted bool `json:"whitelisted,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUserReaction struct { + Comment *RestUserReactionComment `json:"comment,omitempty"` + Emoticon *RestUserReactionEmoticon `json:"emoticon,omitempty"` + User *RestPullRequestParticipantUser `json:"user,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUserReactionComment struct { + Version int32 `json:"version,omitempty"` + Parent *RestUserReactionCommentParent `json:"parent,omitempty"` + Id int64 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Comments []RestComment `json:"comments,omitempty"` + Severity string `json:"severity,omitempty"` + UpdatedDate int64 `json:"updatedDate,omitempty"` + ThreadResolvedDate int64 `json:"threadResolvedDate,omitempty"` + ThreadResolver *RestUserReactionCommentParentThreadResolver `json:"threadResolver,omitempty"` + Anchored bool `json:"anchored,omitempty"` + Pending bool `json:"pending,omitempty"` + // Indicates if this comment thread has been marked as resolved or not + ThreadResolved bool `json:"threadResolved,omitempty"` + Resolver *RestUserReactionCommentParentThreadResolver `json:"resolver,omitempty"` + ResolvedDate int64 `json:"resolvedDate,omitempty"` + Author *RestUserReactionCommentParentThreadResolver `json:"author,omitempty"` + CreatedDate int64 `json:"createdDate,omitempty"` + Anchor *RestUserReactionCommentParentAnchor `json:"anchor,omitempty"` + Html string `json:"html,omitempty"` + Reply bool `json:"reply,omitempty"` + Text string `json:"text,omitempty"` + Properties *interface{} `json:"properties,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUserReactionCommentParent struct { + Version int32 `json:"version,omitempty"` + Id int64 `json:"id,omitempty"` + State string `json:"state,omitempty"` + Comments []RestComment `json:"comments,omitempty"` + Severity string `json:"severity,omitempty"` + UpdatedDate int64 `json:"updatedDate,omitempty"` + ThreadResolvedDate int64 `json:"threadResolvedDate,omitempty"` + ThreadResolver *RestUserReactionCommentParentThreadResolver `json:"threadResolver,omitempty"` + Anchored bool `json:"anchored,omitempty"` + Pending bool `json:"pending,omitempty"` + // Indicates if this comment thread has been marked as resolved or not + ThreadResolved bool `json:"threadResolved,omitempty"` + Resolver *RestUserReactionCommentParentThreadResolver `json:"resolver,omitempty"` + ResolvedDate int64 `json:"resolvedDate,omitempty"` + Author *RestUserReactionCommentParentThreadResolver `json:"author,omitempty"` + CreatedDate int64 `json:"createdDate,omitempty"` + Anchor *RestUserReactionCommentParentAnchor `json:"anchor,omitempty"` + Html string `json:"html,omitempty"` + Reply bool `json:"reply,omitempty"` + Text string `json:"text,omitempty"` + Properties *interface{} `json:"properties,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUserReactionCommentParentAnchor struct { + Path *RestCommentThreadDiffAnchorPath `json:"path,omitempty"` + LineType string `json:"lineType,omitempty"` + FromHash string `json:"fromHash,omitempty"` + FileType string `json:"fileType,omitempty"` + DiffType string `json:"diffType,omitempty"` + PullRequest *RestCommentThreadDiffAnchorPullRequest `json:"pullRequest,omitempty"` + SrcPath *RestCommentThreadDiffAnchorPath `json:"srcPath,omitempty"` + ToHash string `json:"toHash,omitempty"` + LineComment bool `json:"lineComment,omitempty"` + Line int32 `json:"line,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUserReactionCommentParentThreadResolver struct { + Name string `json:"name,omitempty"` + Id int32 `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` + DisplayName string `json:"displayName,omitempty"` + EmailAddress string `json:"emailAddress,omitempty"` + Slug string `json:"slug,omitempty"` + Links *interface{} `json:"links,omitempty"` + Active bool `json:"active,omitempty"` + AvatarUrl string `json:"avatarUrl,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUserReactionEmoticon struct { + Value string `json:"value,omitempty"` + Shortcut string `json:"shortcut,omitempty"` + Url string `json:"url,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestUsernamePasswordCredentials struct { + Password string `json:"password"` + Username string `json:"username"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestWebhook struct { + Name string `json:"name,omitempty"` + SslVerificationRequired bool `json:"sslVerificationRequired,omitempty"` + Events []string `json:"events,omitempty"` + Active bool `json:"active,omitempty"` + Statistics *interface{} `json:"statistics,omitempty"` + ScopeType string `json:"scopeType,omitempty"` + Credentials *RestWebhookCredentials `json:"credentials,omitempty"` + Configuration *interface{} `json:"configuration,omitempty"` + Url string `json:"url,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestWebhookCredentials struct { + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type RestWebhookScope struct { + Id string `json:"id,omitempty"` + Type_ string `json:"type,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type SimpleSshKeyFingerprint struct { + Algorithm string `json:"algorithm,omitempty"` + Value string `json:"value,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type SshKeyIdBody struct { + Projects *RestProject `json:"projects,omitempty"` + Repositories *RestRepository `json:"repositories,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type UserAndGroups struct { + Groups []string `json:"groups"` + User string `json:"user,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type UserPasswordUpdate struct { + OldPassword string `json:"oldPassword,omitempty"` + Password string `json:"password,omitempty"` + PasswordConfirm string `json:"passwordConfirm,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type UserPickerContext struct { + Context string `json:"context,omitempty"` + ItemName string `json:"itemName,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type UserRename struct { + Name string `json:"name,omitempty"` + NewName string `json:"newName,omitempty"` +} + +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +type UserUpdate struct { + DisplayName string `json:"displayName,omitempty"` + Email string `json:"email,omitempty"` + Name string `json:"name,omitempty"` +} diff --git a/vendor/github.com/gdasson/bitbucketv1go/response.go b/vendor/github.com/gdasson/bitbucketv1go/response.go new file mode 100644 index 000000000..adac55324 --- /dev/null +++ b/vendor/github.com/gdasson/bitbucketv1go/response.go @@ -0,0 +1,42 @@ +/* + * Bitbucket Server + * + * This is the reference document for the Atlassian Bitbucket REST API. The REST API is for developers who want to: - integrate Bitbucket with other applications; - create scripts that interact with Bitbucket; or - develop plugins that enhance the Bitbucket UI, using REST to interact with the backend. You can read more about developing Bitbucket plugins in the [Bitbucket Developer Documentation](https://developer.atlassian.com/bitbucket/server/docs/latest/). + * + * API version: 8.14 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package bitbucketv1go + +import ( + "net/http" +) + +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the swagger operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 5397eac24..2c508713f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -25,6 +25,9 @@ github.com/PuerkitoBio/goquery # github.com/andybalholm/cascadia v1.3.2 ## explicit; go 1.16 github.com/andybalholm/cascadia +# github.com/antihax/optional v1.0.0 +## explicit; go 1.13 +github.com/antihax/optional # github.com/antlr4-go/antlr/v4 v4.13.1 ## explicit; go 1.22 github.com/antlr4-go/antlr/v4 @@ -94,6 +97,9 @@ github.com/fvbommel/sortorder # github.com/fxamacker/cbor/v2 v2.7.0 ## explicit; go 1.17 github.com/fxamacker/cbor/v2 +# github.com/gdasson/bitbucketv1go v1.0.0 +## explicit; go 1.20 +github.com/gdasson/bitbucketv1go # github.com/gfleury/go-bitbucket-v1 v0.0.0-20240822132758-a3031aa024b4 ## explicit; go 1.14 github.com/gfleury/go-bitbucket-v1