From 7082595b855c2e76295e81e796edf94884592440 Mon Sep 17 00:00:00 2001 From: Will Refvem Date: Tue, 20 Mar 2018 23:40:56 -0400 Subject: [PATCH] Initial commit --- .gitignore | 24 + .swagger-codegen-ignore | 23 + .swagger-codegen/VERSION | 1 + .travis.yml | 8 + README.md | 482 + account.go | 32 + account_links.go | 26 + addon_api.go | 794 + api/swagger.yaml | 12872 +++++++++++++++++ api_client.go | 463 + api_response.go | 44 + author.go | 21 + base_commit.go | 32 + branchrestriction.go | 31 + branchrestrictions_api.go | 431 + comment.go | 38 + comment_inline.go | 23 + comment_links.go | 20 + commit.go | 38 + commit_file.go | 24 + commit_links.go | 28 + commits_api.go | 923 ++ commitstatus.go | 47 + commitstatus_links.go | 18 + commitstatuses_api.go | 451 + component.go | 22 + config.json | 3 + configuration.go | 73 + default_api.go | 596 + docs/Account.md | 16 + docs/AccountLinks.md | 15 + docs/AddonApi.md | 286 + docs/Author.md | 12 + docs/BaseCommit.md | 16 + docs/Branchrestriction.md | 16 + docs/BranchrestrictionsApi.md | 163 + docs/Comment.md | 19 + docs/CommentInline.md | 12 + docs/CommentLinks.md | 12 + docs/Commit.md | 19 + docs/CommitFile.md | 13 + docs/CommitLinks.md | 16 + docs/CommitsApi.md | 361 + docs/Commitstatus.md | 20 + docs/CommitstatusLinks.md | 11 + docs/CommitstatusesApi.md | 188 + docs/Component.md | 13 + docs/DefaultApi.md | 238 + docs/DownloadsApi.md | 130 + docs/ErrorError.md | 12 + docs/Group.md | 16 + docs/GroupLinks.md | 11 + docs/HookEvent.md | 13 + docs/Issue.md | 27 + docs/IssueAttachment.md | 12 + docs/IssueChange.md | 17 + docs/IssueChangeChanges.md | 18 + docs/IssueChangeChangesAssignee.md | 11 + docs/IssueChangeLinks.md | 11 + docs/IssueLinks.md | 15 + docs/IssueTrackerApi.md | 827 ++ docs/Milestone.md | 13 + docs/MilestoneLinks.md | 10 + docs/MilestoneLinksSelf.md | 11 + docs/ModelError.md | 11 + docs/Object.md | 10 + docs/Page.md | 14 + docs/PaginatedBranchrestrictions.md | 15 + docs/PaginatedCommitstatuses.md | 15 + docs/PaginatedComponents.md | 15 + docs/PaginatedFiles.md | 15 + docs/PaginatedHookEvents.md | 15 + docs/PaginatedIssueAttachments.md | 15 + docs/PaginatedIssues.md | 15 + docs/PaginatedLogEntries.md | 15 + docs/PaginatedMilestones.md | 15 + docs/PaginatedPipelineKnownHosts.md | 15 + docs/PaginatedPipelineScheduleExecutions.md | 15 + docs/PaginatedPipelineSchedules.md | 15 + docs/PaginatedPipelineSteps.md | 15 + docs/PaginatedPipelineVariables.md | 15 + docs/PaginatedPipelines.md | 15 + docs/PaginatedProjects.md | 15 + docs/PaginatedPullrequestComments.md | 15 + docs/PaginatedPullrequests.md | 15 + docs/PaginatedRepositories.md | 15 + docs/PaginatedRepositoryPermissions.md | 15 + docs/PaginatedSnippetComments.md | 15 + docs/PaginatedSnippetCommit.md | 15 + docs/PaginatedSnippets.md | 15 + docs/PaginatedSshUserKeys.md | 15 + docs/PaginatedTeamPermissions.md | 15 + docs/PaginatedTeams.md | 15 + docs/PaginatedTreeentries.md | 15 + docs/PaginatedUsers.md | 15 + docs/PaginatedVersions.md | 15 + docs/PaginatedWebhookSubscriptions.md | 15 + docs/Participant.md | 14 + docs/Pipeline.md | 20 + docs/PipelineBuildNumber.md | 11 + docs/PipelineCommand.md | 12 + docs/PipelineCommitTarget.md | 12 + docs/PipelineError.md | 12 + docs/PipelineImage.md | 13 + docs/PipelineKnownHost.md | 13 + docs/PipelineLogRange.md | 11 + docs/PipelineRefTarget.md | 14 + docs/PipelineSchedule.md | 17 + docs/PipelineScheduleExecution.md | 10 + docs/PipelineScheduleExecutionErrored.md | 11 + docs/PipelineScheduleExecutionExecuted.md | 11 + docs/PipelineSelector.md | 11 + docs/PipelineSshKeyPair.md | 12 + docs/PipelineSshPublicKey.md | 14 + docs/PipelineState.md | 10 + docs/PipelineStateCompleted.md | 12 + docs/PipelineStateCompletedError.md | 12 + docs/PipelineStateCompletedExpired.md | 11 + docs/PipelineStateCompletedFailed.md | 11 + docs/PipelineStateCompletedResult.md | 10 + docs/PipelineStateCompletedStopped.md | 11 + docs/PipelineStateCompletedSuccessful.md | 11 + docs/PipelineStateInProgress.md | 12 + docs/PipelineStateInProgressPaused.md | 11 + docs/PipelineStateInProgressRunning.md | 11 + docs/PipelineStateInProgressStage.md | 10 + docs/PipelineStatePending.md | 11 + docs/PipelineStep.md | 18 + docs/PipelineStepError.md | 12 + docs/PipelineStepState.md | 10 + docs/PipelineStepStateCompleted.md | 12 + docs/PipelineStepStateCompletedError.md | 12 + docs/PipelineStepStateCompletedExpired.md | 11 + docs/PipelineStepStateCompletedFailed.md | 11 + docs/PipelineStepStateCompletedNotRun.md | 11 + docs/PipelineStepStateCompletedResult.md | 10 + docs/PipelineStepStateCompletedStopped.md | 11 + docs/PipelineStepStateCompletedSuccessful.md | 11 + docs/PipelineStepStateInProgress.md | 11 + docs/PipelineStepStatePending.md | 11 + docs/PipelineStepStateReady.md | 11 + docs/PipelineTarget.md | 10 + docs/PipelineTrigger.md | 10 + docs/PipelineTriggerManual.md | 10 + docs/PipelineTriggerPush.md | 10 + docs/PipelineVariable.md | 14 + docs/PipelinesApi.md | 1220 ++ docs/PipelinesConfig.md | 12 + docs/Project.md | 19 + docs/ProjectLinks.md | 11 + docs/ProjectsApi.md | 158 + docs/Pullrequest.md | 28 + docs/PullrequestComment.md | 20 + docs/PullrequestEndpoint.md | 12 + docs/PullrequestEndpointBranch.md | 10 + docs/PullrequestLinks.md | 18 + docs/PullrequestMergeCommit.md | 10 + docs/PullrequestMergeParameters.md | 13 + docs/PullrequestSummary.md | 12 + docs/PullrequestsApi.md | 668 + docs/RefsApi.md | 191 + docs/RepositoriesApi.md | 879 ++ docs/Repository.md | 27 + docs/RepositoryLinks.md | 19 + docs/RepositoryPermission.md | 13 + docs/SearchResult.md | 11 + docs/Snippet.md | 18 + docs/SnippetComment.md | 12 + docs/SnippetCommit.md | 18 + docs/SnippetCommitLinks.md | 12 + docs/SnippetsApi.md | 764 + docs/SourceApi.md | 185 + docs/SshAccountKey.md | 18 + docs/SshApi.md | 175 + docs/SshKey.md | 17 + docs/SubjectTypes.md | 12 + docs/SubjectTypesRepository.md | 10 + docs/Tag.md | 16 + docs/TagLinks.md | 12 + docs/Team.md | 16 + docs/TeamPermission.md | 13 + docs/TeamsApi.md | 366 + docs/Treeentry.md | 12 + docs/User.md | 18 + docs/UsersApi.md | 380 + docs/Version.md | 13 + docs/WebhookSubscription.md | 18 + docs/WebhooksApi.md | 511 + downloads_api.go | 350 + error_error.go | 21 + git_push.sh | 52 + group.go | 31 + group_links.go | 18 + hook_event.go | 27 + issue.go | 54 + issue_attachment.go | 20 + issue_change.go | 35 + issue_change_changes.go | 32 + issue_change_changes_assignee.go | 18 + issue_change_links.go | 18 + issue_links.go | 26 + issue_tracker_api.go | 2137 +++ milestone.go | 22 + milestone_links.go | 16 + milestone_links_self.go | 18 + model_error.go | 19 + object.go | 17 + page.go | 29 + paginated_branchrestrictions.go | 32 + paginated_commitstatuses.go | 32 + paginated_components.go | 32 + paginated_files.go | 32 + paginated_hook_events.go | 32 + paginated_issue_attachments.go | 32 + paginated_issues.go | 32 + paginated_log_entries.go | 32 + paginated_milestones.go | 32 + paginated_pipeline_known_hosts.go | 33 + paginated_pipeline_schedule_executions.go | 33 + paginated_pipeline_schedules.go | 33 + paginated_pipeline_steps.go | 33 + paginated_pipeline_variables.go | 33 + paginated_pipelines.go | 33 + paginated_projects.go | 32 + paginated_pullrequest_comments.go | 32 + paginated_pullrequests.go | 32 + paginated_repositories.go | 32 + paginated_repository_permissions.go | 32 + paginated_snippet_comments.go | 32 + paginated_snippet_commit.go | 32 + paginated_snippets.go | 32 + paginated_ssh_user_keys.go | 32 + paginated_team_permissions.go | 32 + paginated_teams.go | 32 + paginated_treeentries.go | 32 + paginated_users.go | 32 + paginated_versions.go | 32 + paginated_webhook_subscriptions.go | 32 + participant.go | 29 + pipeline.go | 48 + pipeline_build_number.go | 19 + pipeline_command.go | 24 + pipeline_commit_target.go | 20 + pipeline_error.go | 22 + pipeline_image.go | 27 + pipeline_known_host.go | 25 + pipeline_log_range.go | 21 + pipeline_ref_target.go | 26 + pipeline_schedule.go | 40 + pipeline_schedule_execution.go | 16 + pipeline_schedule_execution_errored.go | 19 + pipeline_schedule_execution_executed.go | 19 + pipeline_selector.go | 20 + pipeline_ssh_key_pair.go | 22 + pipeline_ssh_public_key.go | 28 + pipeline_state.go | 16 + pipeline_state_completed.go | 22 + pipeline_state_completed_error.go | 22 + pipeline_state_completed_expired.go | 19 + pipeline_state_completed_failed.go | 19 + pipeline_state_completed_result.go | 16 + pipeline_state_completed_stopped.go | 19 + pipeline_state_completed_successful.go | 19 + pipeline_state_in_progress.go | 22 + pipeline_state_in_progress_paused.go | 19 + pipeline_state_in_progress_running.go | 19 + pipeline_state_in_progress_stage.go | 16 + pipeline_state_pending.go | 19 + pipeline_step.go | 44 + pipeline_step_error.go | 22 + pipeline_step_state.go | 16 + pipeline_step_state_completed.go | 22 + pipeline_step_state_completed_error.go | 22 + pipeline_step_state_completed_expired.go | 19 + pipeline_step_state_completed_failed.go | 19 + pipeline_step_state_completed_not_run.go | 19 + pipeline_step_state_completed_result.go | 16 + pipeline_step_state_completed_stopped.go | 19 + pipeline_step_state_completed_successful.go | 19 + pipeline_step_state_in_progress.go | 19 + pipeline_step_state_pending.go | 19 + pipeline_step_state_ready.go | 19 + pipeline_target.go | 16 + pipeline_trigger.go | 16 + pipeline_trigger_manual.go | 16 + pipeline_trigger_push.go | 16 + pipeline_variable.go | 28 + pipelines_api.go | 2667 ++++ pipelines_config.go | 21 + project.go | 42 + project_links.go | 18 + projects_api.go | 421 + pullrequest.go | 67 + pullrequest_comment.go | 40 + pullrequest_endpoint.go | 20 + pullrequest_endpoint_branch.go | 16 + pullrequest_links.go | 32 + pullrequest_merge_commit.go | 16 + pullrequest_merge_parameters.go | 26 + pullrequest_summary.go | 23 + pullrequests_api.go | 1648 +++ refs_api.go | 511 + repositories_api.go | 2090 +++ repository.go | 57 + repository_links.go | 34 + repository_permission.go | 23 + search_result.go | 18 + snippet.go | 37 + snippet_comment.go | 20 + snippet_commit.go | 36 + snippet_commit_links.go | 20 + snippets_api.go | 1935 +++ source_api.go | 443 + ssh_account_key.go | 40 + ssh_api.go | 427 + ssh_key.go | 38 + subject_types.go | 21 + subject_types_repository.go | 16 + tag.go | 36 + tag_links.go | 20 + team.go | 32 + team_permission.go | 23 + teams_api.go | 960 ++ treeentry.go | 22 + user.go | 37 + users_api.go | 1027 ++ version.go | 22 + webhook_subscription.go | 41 + webhooks_api.go | 1347 ++ 329 files changed, 46591 insertions(+) create mode 100644 .gitignore create mode 100644 .swagger-codegen-ignore create mode 100644 .swagger-codegen/VERSION create mode 100644 .travis.yml create mode 100644 README.md create mode 100644 account.go create mode 100644 account_links.go create mode 100644 addon_api.go create mode 100644 api/swagger.yaml create mode 100644 api_client.go create mode 100644 api_response.go create mode 100644 author.go create mode 100644 base_commit.go create mode 100644 branchrestriction.go create mode 100644 branchrestrictions_api.go create mode 100644 comment.go create mode 100644 comment_inline.go create mode 100644 comment_links.go create mode 100644 commit.go create mode 100644 commit_file.go create mode 100644 commit_links.go create mode 100644 commits_api.go create mode 100644 commitstatus.go create mode 100644 commitstatus_links.go create mode 100644 commitstatuses_api.go create mode 100644 component.go create mode 100644 config.json create mode 100644 configuration.go create mode 100644 default_api.go create mode 100644 docs/Account.md create mode 100644 docs/AccountLinks.md create mode 100644 docs/AddonApi.md create mode 100644 docs/Author.md create mode 100644 docs/BaseCommit.md create mode 100644 docs/Branchrestriction.md create mode 100644 docs/BranchrestrictionsApi.md create mode 100644 docs/Comment.md create mode 100644 docs/CommentInline.md create mode 100644 docs/CommentLinks.md create mode 100644 docs/Commit.md create mode 100644 docs/CommitFile.md create mode 100644 docs/CommitLinks.md create mode 100644 docs/CommitsApi.md create mode 100644 docs/Commitstatus.md create mode 100644 docs/CommitstatusLinks.md create mode 100644 docs/CommitstatusesApi.md create mode 100644 docs/Component.md create mode 100644 docs/DefaultApi.md create mode 100644 docs/DownloadsApi.md create mode 100644 docs/ErrorError.md create mode 100644 docs/Group.md create mode 100644 docs/GroupLinks.md create mode 100644 docs/HookEvent.md create mode 100644 docs/Issue.md create mode 100644 docs/IssueAttachment.md create mode 100644 docs/IssueChange.md create mode 100644 docs/IssueChangeChanges.md create mode 100644 docs/IssueChangeChangesAssignee.md create mode 100644 docs/IssueChangeLinks.md create mode 100644 docs/IssueLinks.md create mode 100644 docs/IssueTrackerApi.md create mode 100644 docs/Milestone.md create mode 100644 docs/MilestoneLinks.md create mode 100644 docs/MilestoneLinksSelf.md create mode 100644 docs/ModelError.md create mode 100644 docs/Object.md create mode 100644 docs/Page.md create mode 100644 docs/PaginatedBranchrestrictions.md create mode 100644 docs/PaginatedCommitstatuses.md create mode 100644 docs/PaginatedComponents.md create mode 100644 docs/PaginatedFiles.md create mode 100644 docs/PaginatedHookEvents.md create mode 100644 docs/PaginatedIssueAttachments.md create mode 100644 docs/PaginatedIssues.md create mode 100644 docs/PaginatedLogEntries.md create mode 100644 docs/PaginatedMilestones.md create mode 100644 docs/PaginatedPipelineKnownHosts.md create mode 100644 docs/PaginatedPipelineScheduleExecutions.md create mode 100644 docs/PaginatedPipelineSchedules.md create mode 100644 docs/PaginatedPipelineSteps.md create mode 100644 docs/PaginatedPipelineVariables.md create mode 100644 docs/PaginatedPipelines.md create mode 100644 docs/PaginatedProjects.md create mode 100644 docs/PaginatedPullrequestComments.md create mode 100644 docs/PaginatedPullrequests.md create mode 100644 docs/PaginatedRepositories.md create mode 100644 docs/PaginatedRepositoryPermissions.md create mode 100644 docs/PaginatedSnippetComments.md create mode 100644 docs/PaginatedSnippetCommit.md create mode 100644 docs/PaginatedSnippets.md create mode 100644 docs/PaginatedSshUserKeys.md create mode 100644 docs/PaginatedTeamPermissions.md create mode 100644 docs/PaginatedTeams.md create mode 100644 docs/PaginatedTreeentries.md create mode 100644 docs/PaginatedUsers.md create mode 100644 docs/PaginatedVersions.md create mode 100644 docs/PaginatedWebhookSubscriptions.md create mode 100644 docs/Participant.md create mode 100644 docs/Pipeline.md create mode 100644 docs/PipelineBuildNumber.md create mode 100644 docs/PipelineCommand.md create mode 100644 docs/PipelineCommitTarget.md create mode 100644 docs/PipelineError.md create mode 100644 docs/PipelineImage.md create mode 100644 docs/PipelineKnownHost.md create mode 100644 docs/PipelineLogRange.md create mode 100644 docs/PipelineRefTarget.md create mode 100644 docs/PipelineSchedule.md create mode 100644 docs/PipelineScheduleExecution.md create mode 100644 docs/PipelineScheduleExecutionErrored.md create mode 100644 docs/PipelineScheduleExecutionExecuted.md create mode 100644 docs/PipelineSelector.md create mode 100644 docs/PipelineSshKeyPair.md create mode 100644 docs/PipelineSshPublicKey.md create mode 100644 docs/PipelineState.md create mode 100644 docs/PipelineStateCompleted.md create mode 100644 docs/PipelineStateCompletedError.md create mode 100644 docs/PipelineStateCompletedExpired.md create mode 100644 docs/PipelineStateCompletedFailed.md create mode 100644 docs/PipelineStateCompletedResult.md create mode 100644 docs/PipelineStateCompletedStopped.md create mode 100644 docs/PipelineStateCompletedSuccessful.md create mode 100644 docs/PipelineStateInProgress.md create mode 100644 docs/PipelineStateInProgressPaused.md create mode 100644 docs/PipelineStateInProgressRunning.md create mode 100644 docs/PipelineStateInProgressStage.md create mode 100644 docs/PipelineStatePending.md create mode 100644 docs/PipelineStep.md create mode 100644 docs/PipelineStepError.md create mode 100644 docs/PipelineStepState.md create mode 100644 docs/PipelineStepStateCompleted.md create mode 100644 docs/PipelineStepStateCompletedError.md create mode 100644 docs/PipelineStepStateCompletedExpired.md create mode 100644 docs/PipelineStepStateCompletedFailed.md create mode 100644 docs/PipelineStepStateCompletedNotRun.md create mode 100644 docs/PipelineStepStateCompletedResult.md create mode 100644 docs/PipelineStepStateCompletedStopped.md create mode 100644 docs/PipelineStepStateCompletedSuccessful.md create mode 100644 docs/PipelineStepStateInProgress.md create mode 100644 docs/PipelineStepStatePending.md create mode 100644 docs/PipelineStepStateReady.md create mode 100644 docs/PipelineTarget.md create mode 100644 docs/PipelineTrigger.md create mode 100644 docs/PipelineTriggerManual.md create mode 100644 docs/PipelineTriggerPush.md create mode 100644 docs/PipelineVariable.md create mode 100644 docs/PipelinesApi.md create mode 100644 docs/PipelinesConfig.md create mode 100644 docs/Project.md create mode 100644 docs/ProjectLinks.md create mode 100644 docs/ProjectsApi.md create mode 100644 docs/Pullrequest.md create mode 100644 docs/PullrequestComment.md create mode 100644 docs/PullrequestEndpoint.md create mode 100644 docs/PullrequestEndpointBranch.md create mode 100644 docs/PullrequestLinks.md create mode 100644 docs/PullrequestMergeCommit.md create mode 100644 docs/PullrequestMergeParameters.md create mode 100644 docs/PullrequestSummary.md create mode 100644 docs/PullrequestsApi.md create mode 100644 docs/RefsApi.md create mode 100644 docs/RepositoriesApi.md create mode 100644 docs/Repository.md create mode 100644 docs/RepositoryLinks.md create mode 100644 docs/RepositoryPermission.md create mode 100644 docs/SearchResult.md create mode 100644 docs/Snippet.md create mode 100644 docs/SnippetComment.md create mode 100644 docs/SnippetCommit.md create mode 100644 docs/SnippetCommitLinks.md create mode 100644 docs/SnippetsApi.md create mode 100644 docs/SourceApi.md create mode 100644 docs/SshAccountKey.md create mode 100644 docs/SshApi.md create mode 100644 docs/SshKey.md create mode 100644 docs/SubjectTypes.md create mode 100644 docs/SubjectTypesRepository.md create mode 100644 docs/Tag.md create mode 100644 docs/TagLinks.md create mode 100644 docs/Team.md create mode 100644 docs/TeamPermission.md create mode 100644 docs/TeamsApi.md create mode 100644 docs/Treeentry.md create mode 100644 docs/User.md create mode 100644 docs/UsersApi.md create mode 100644 docs/Version.md create mode 100644 docs/WebhookSubscription.md create mode 100644 docs/WebhooksApi.md create mode 100644 downloads_api.go create mode 100644 error_error.go create mode 100644 git_push.sh create mode 100644 group.go create mode 100644 group_links.go create mode 100644 hook_event.go create mode 100644 issue.go create mode 100644 issue_attachment.go create mode 100644 issue_change.go create mode 100644 issue_change_changes.go create mode 100644 issue_change_changes_assignee.go create mode 100644 issue_change_links.go create mode 100644 issue_links.go create mode 100644 issue_tracker_api.go create mode 100644 milestone.go create mode 100644 milestone_links.go create mode 100644 milestone_links_self.go create mode 100644 model_error.go create mode 100644 object.go create mode 100644 page.go create mode 100644 paginated_branchrestrictions.go create mode 100644 paginated_commitstatuses.go create mode 100644 paginated_components.go create mode 100644 paginated_files.go create mode 100644 paginated_hook_events.go create mode 100644 paginated_issue_attachments.go create mode 100644 paginated_issues.go create mode 100644 paginated_log_entries.go create mode 100644 paginated_milestones.go create mode 100644 paginated_pipeline_known_hosts.go create mode 100644 paginated_pipeline_schedule_executions.go create mode 100644 paginated_pipeline_schedules.go create mode 100644 paginated_pipeline_steps.go create mode 100644 paginated_pipeline_variables.go create mode 100644 paginated_pipelines.go create mode 100644 paginated_projects.go create mode 100644 paginated_pullrequest_comments.go create mode 100644 paginated_pullrequests.go create mode 100644 paginated_repositories.go create mode 100644 paginated_repository_permissions.go create mode 100644 paginated_snippet_comments.go create mode 100644 paginated_snippet_commit.go create mode 100644 paginated_snippets.go create mode 100644 paginated_ssh_user_keys.go create mode 100644 paginated_team_permissions.go create mode 100644 paginated_teams.go create mode 100644 paginated_treeentries.go create mode 100644 paginated_users.go create mode 100644 paginated_versions.go create mode 100644 paginated_webhook_subscriptions.go create mode 100644 participant.go create mode 100644 pipeline.go create mode 100644 pipeline_build_number.go create mode 100644 pipeline_command.go create mode 100644 pipeline_commit_target.go create mode 100644 pipeline_error.go create mode 100644 pipeline_image.go create mode 100644 pipeline_known_host.go create mode 100644 pipeline_log_range.go create mode 100644 pipeline_ref_target.go create mode 100644 pipeline_schedule.go create mode 100644 pipeline_schedule_execution.go create mode 100644 pipeline_schedule_execution_errored.go create mode 100644 pipeline_schedule_execution_executed.go create mode 100644 pipeline_selector.go create mode 100644 pipeline_ssh_key_pair.go create mode 100644 pipeline_ssh_public_key.go create mode 100644 pipeline_state.go create mode 100644 pipeline_state_completed.go create mode 100644 pipeline_state_completed_error.go create mode 100644 pipeline_state_completed_expired.go create mode 100644 pipeline_state_completed_failed.go create mode 100644 pipeline_state_completed_result.go create mode 100644 pipeline_state_completed_stopped.go create mode 100644 pipeline_state_completed_successful.go create mode 100644 pipeline_state_in_progress.go create mode 100644 pipeline_state_in_progress_paused.go create mode 100644 pipeline_state_in_progress_running.go create mode 100644 pipeline_state_in_progress_stage.go create mode 100644 pipeline_state_pending.go create mode 100644 pipeline_step.go create mode 100644 pipeline_step_error.go create mode 100644 pipeline_step_state.go create mode 100644 pipeline_step_state_completed.go create mode 100644 pipeline_step_state_completed_error.go create mode 100644 pipeline_step_state_completed_expired.go create mode 100644 pipeline_step_state_completed_failed.go create mode 100644 pipeline_step_state_completed_not_run.go create mode 100644 pipeline_step_state_completed_result.go create mode 100644 pipeline_step_state_completed_stopped.go create mode 100644 pipeline_step_state_completed_successful.go create mode 100644 pipeline_step_state_in_progress.go create mode 100644 pipeline_step_state_pending.go create mode 100644 pipeline_step_state_ready.go create mode 100644 pipeline_target.go create mode 100644 pipeline_trigger.go create mode 100644 pipeline_trigger_manual.go create mode 100644 pipeline_trigger_push.go create mode 100644 pipeline_variable.go create mode 100644 pipelines_api.go create mode 100644 pipelines_config.go create mode 100644 project.go create mode 100644 project_links.go create mode 100644 projects_api.go create mode 100644 pullrequest.go create mode 100644 pullrequest_comment.go create mode 100644 pullrequest_endpoint.go create mode 100644 pullrequest_endpoint_branch.go create mode 100644 pullrequest_links.go create mode 100644 pullrequest_merge_commit.go create mode 100644 pullrequest_merge_parameters.go create mode 100644 pullrequest_summary.go create mode 100644 pullrequests_api.go create mode 100644 refs_api.go create mode 100644 repositories_api.go create mode 100644 repository.go create mode 100644 repository_links.go create mode 100644 repository_permission.go create mode 100644 search_result.go create mode 100644 snippet.go create mode 100644 snippet_comment.go create mode 100644 snippet_commit.go create mode 100644 snippet_commit_links.go create mode 100644 snippets_api.go create mode 100644 source_api.go create mode 100644 ssh_account_key.go create mode 100644 ssh_api.go create mode 100644 ssh_key.go create mode 100644 subject_types.go create mode 100644 subject_types_repository.go create mode 100644 tag.go create mode 100644 tag_links.go create mode 100644 team.go create mode 100644 team_permission.go create mode 100644 teams_api.go create mode 100644 treeentry.go create mode 100644 user.go create mode 100644 users_api.go create mode 100644 version.go create mode 100644 webhook_subscription.go create mode 100644 webhooks_api.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..daf913b --- /dev/null +++ b/.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/.swagger-codegen-ignore b/.swagger-codegen-ignore new file mode 100644 index 0000000..c5fa491 --- /dev/null +++ b/.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/.swagger-codegen/VERSION b/.swagger-codegen/VERSION new file mode 100644 index 0000000..a625450 --- /dev/null +++ b/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.1 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f5cb2ce --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/README.md b/README.md new file mode 100644 index 0000000..db5bc84 --- /dev/null +++ b/README.md @@ -0,0 +1,482 @@ +# Go API client for bitbucket + +Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + +## 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: 2.0 +- Package version: 1.0.0 +- Build package: io.swagger.codegen.languages.GoClientCodegen +For more information, please visit [https://support.atlassian.com/bitbucket-cloud/](https://support.atlassian.com/bitbucket-cloud/) + +## Installation +Put the package under your project folder and add the following in import: +``` + "./bitbucket" +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AddonApi* | [**AddonDelete**](docs/AddonApi.md#addondelete) | **Delete** /addon | +*AddonApi* | [**AddonLinkersGet**](docs/AddonApi.md#addonlinkersget) | **Get** /addon/linkers | +*AddonApi* | [**AddonLinkersLinkerKeyGet**](docs/AddonApi.md#addonlinkerslinkerkeyget) | **Get** /addon/linkers/{linker_key} | +*AddonApi* | [**AddonLinkersLinkerKeyValuesDelete**](docs/AddonApi.md#addonlinkerslinkerkeyvaluesdelete) | **Delete** /addon/linkers/{linker_key}/values | +*AddonApi* | [**AddonLinkersLinkerKeyValuesDelete_0**](docs/AddonApi.md#addonlinkerslinkerkeyvaluesdelete_0) | **Delete** /addon/linkers/{linker_key}/values/ | +*AddonApi* | [**AddonLinkersLinkerKeyValuesGet**](docs/AddonApi.md#addonlinkerslinkerkeyvaluesget) | **Get** /addon/linkers/{linker_key}/values | +*AddonApi* | [**AddonLinkersLinkerKeyValuesGet_0**](docs/AddonApi.md#addonlinkerslinkerkeyvaluesget_0) | **Get** /addon/linkers/{linker_key}/values/ | +*AddonApi* | [**AddonLinkersLinkerKeyValuesPost**](docs/AddonApi.md#addonlinkerslinkerkeyvaluespost) | **Post** /addon/linkers/{linker_key}/values | +*AddonApi* | [**AddonLinkersLinkerKeyValuesPut**](docs/AddonApi.md#addonlinkerslinkerkeyvaluesput) | **Put** /addon/linkers/{linker_key}/values | +*AddonApi* | [**AddonPut**](docs/AddonApi.md#addonput) | **Put** /addon | +*BranchrestrictionsApi* | [**RepositoriesUsernameRepoSlugBranchRestrictionsGet**](docs/BranchrestrictionsApi.md#repositoriesusernamereposlugbranchrestrictionsget) | **Get** /repositories/{username}/{repo_slug}/branch-restrictions | +*BranchrestrictionsApi* | [**RepositoriesUsernameRepoSlugBranchRestrictionsIdDelete**](docs/BranchrestrictionsApi.md#repositoriesusernamereposlugbranchrestrictionsiddelete) | **Delete** /repositories/{username}/{repo_slug}/branch-restrictions/{id} | +*BranchrestrictionsApi* | [**RepositoriesUsernameRepoSlugBranchRestrictionsIdGet**](docs/BranchrestrictionsApi.md#repositoriesusernamereposlugbranchrestrictionsidget) | **Get** /repositories/{username}/{repo_slug}/branch-restrictions/{id} | +*BranchrestrictionsApi* | [**RepositoriesUsernameRepoSlugBranchRestrictionsIdPut**](docs/BranchrestrictionsApi.md#repositoriesusernamereposlugbranchrestrictionsidput) | **Put** /repositories/{username}/{repo_slug}/branch-restrictions/{id} | +*BranchrestrictionsApi* | [**RepositoriesUsernameRepoSlugBranchRestrictionsPost**](docs/BranchrestrictionsApi.md#repositoriesusernamereposlugbranchrestrictionspost) | **Post** /repositories/{username}/{repo_slug}/branch-restrictions | +*CommitsApi* | [**RepositoriesUsernameRepoSlugCommitNodeApproveDelete**](docs/CommitsApi.md#repositoriesusernamereposlugcommitnodeapprovedelete) | **Delete** /repositories/{username}/{repo_slug}/commit/{node}/approve | +*CommitsApi* | [**RepositoriesUsernameRepoSlugCommitNodeApprovePost**](docs/CommitsApi.md#repositoriesusernamereposlugcommitnodeapprovepost) | **Post** /repositories/{username}/{repo_slug}/commit/{node}/approve | +*CommitsApi* | [**RepositoriesUsernameRepoSlugCommitRevisionGet**](docs/CommitsApi.md#repositoriesusernamereposlugcommitrevisionget) | **Get** /repositories/{username}/{repo_slug}/commit/{revision} | +*CommitsApi* | [**RepositoriesUsernameRepoSlugCommitShaCommentsCommentIdGet**](docs/CommitsApi.md#repositoriesusernamereposlugcommitshacommentscommentidget) | **Get** /repositories/{username}/{repo_slug}/commit/{sha}/comments/{comment_id} | +*CommitsApi* | [**RepositoriesUsernameRepoSlugCommitShaCommentsGet**](docs/CommitsApi.md#repositoriesusernamereposlugcommitshacommentsget) | **Get** /repositories/{username}/{repo_slug}/commit/{sha}/comments | +*CommitsApi* | [**RepositoriesUsernameRepoSlugCommitsGet**](docs/CommitsApi.md#repositoriesusernamereposlugcommitsget) | **Get** /repositories/{username}/{repo_slug}/commits | +*CommitsApi* | [**RepositoriesUsernameRepoSlugCommitsPost**](docs/CommitsApi.md#repositoriesusernamereposlugcommitspost) | **Post** /repositories/{username}/{repo_slug}/commits | +*CommitsApi* | [**RepositoriesUsernameRepoSlugCommitsRevisionGet**](docs/CommitsApi.md#repositoriesusernamereposlugcommitsrevisionget) | **Get** /repositories/{username}/{repo_slug}/commits/{revision} | +*CommitsApi* | [**RepositoriesUsernameRepoSlugCommitsRevisionPost**](docs/CommitsApi.md#repositoriesusernamereposlugcommitsrevisionpost) | **Post** /repositories/{username}/{repo_slug}/commits/{revision} | +*CommitsApi* | [**RepositoriesUsernameRepoSlugDiffSpecGet**](docs/CommitsApi.md#repositoriesusernamereposlugdiffspecget) | **Get** /repositories/{username}/{repo_slug}/diff/{spec} | +*CommitsApi* | [**RepositoriesUsernameRepoSlugPatchSpecGet**](docs/CommitsApi.md#repositoriesusernamereposlugpatchspecget) | **Get** /repositories/{username}/{repo_slug}/patch/{spec} | +*CommitstatusesApi* | [**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet**](docs/CommitstatusesApi.md#repositoriesusernamereposlugcommitnodestatusesbuildkeyget) | **Get** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key} | +*CommitstatusesApi* | [**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut**](docs/CommitstatusesApi.md#repositoriesusernamereposlugcommitnodestatusesbuildkeyput) | **Put** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key} | +*CommitstatusesApi* | [**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost**](docs/CommitstatusesApi.md#repositoriesusernamereposlugcommitnodestatusesbuildpost) | **Post** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build | +*CommitstatusesApi* | [**RepositoriesUsernameRepoSlugCommitNodeStatusesGet**](docs/CommitstatusesApi.md#repositoriesusernamereposlugcommitnodestatusesget) | **Get** /repositories/{username}/{repo_slug}/commit/{node}/statuses | +*CommitstatusesApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet**](docs/CommitstatusesApi.md#repositoriesusernamereposlugpullrequestspullrequestidstatusesget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/statuses | +*DefaultApi* | [**RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameDelete**](docs/DefaultApi.md#repositoriesusernamereposlugpropertiesappkeypropertynamedelete) | **Delete** /repositories/{username}/{repo_slug}/properties/{app_key}/{property_name} | +*DefaultApi* | [**RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameGet**](docs/DefaultApi.md#repositoriesusernamereposlugpropertiesappkeypropertynameget) | **Get** /repositories/{username}/{repo_slug}/properties/{app_key}/{property_name} | +*DefaultApi* | [**RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNamePut**](docs/DefaultApi.md#repositoriesusernamereposlugpropertiesappkeypropertynameput) | **Put** /repositories/{username}/{repo_slug}/properties/{app_key}/{property_name} | +*DefaultApi* | [**TeamsUsernamePermissionsGet**](docs/DefaultApi.md#teamsusernamepermissionsget) | **Get** /teams/{username}/permissions | +*DefaultApi* | [**TeamsUsernamePermissionsRepositoriesGet**](docs/DefaultApi.md#teamsusernamepermissionsrepositoriesget) | **Get** /teams/{username}/permissions/repositories | +*DefaultApi* | [**TeamsUsernameSearchCodeGet**](docs/DefaultApi.md#teamsusernamesearchcodeget) | **Get** /teams/{username}/search/code | +*DefaultApi* | [**UserPermissionsTeamsGet**](docs/DefaultApi.md#userpermissionsteamsget) | **Get** /user/permissions/teams | +*DefaultApi* | [**UsersUsernameSearchCodeGet**](docs/DefaultApi.md#usersusernamesearchcodeget) | **Get** /users/{username}/search/code | +*DownloadsApi* | [**RepositoriesUsernameRepoSlugDownloadsFilenameDelete**](docs/DownloadsApi.md#repositoriesusernamereposlugdownloadsfilenamedelete) | **Delete** /repositories/{username}/{repo_slug}/downloads/{filename} | +*DownloadsApi* | [**RepositoriesUsernameRepoSlugDownloadsFilenameGet**](docs/DownloadsApi.md#repositoriesusernamereposlugdownloadsfilenameget) | **Get** /repositories/{username}/{repo_slug}/downloads/{filename} | +*DownloadsApi* | [**RepositoriesUsernameRepoSlugDownloadsGet**](docs/DownloadsApi.md#repositoriesusernamereposlugdownloadsget) | **Get** /repositories/{username}/{repo_slug}/downloads | +*DownloadsApi* | [**RepositoriesUsernameRepoSlugDownloadsPost**](docs/DownloadsApi.md#repositoriesusernamereposlugdownloadspost) | **Post** /repositories/{username}/{repo_slug}/downloads | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugComponentsComponentIdGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugcomponentscomponentidget) | **Get** /repositories/{username}/{repo_slug}/components/{component_id} | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugComponentsGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugcomponentsget) | **Get** /repositories/{username}/{repo_slug}/components | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesget) | **Get** /repositories/{username}/{repo_slug}/issues | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidattachmentsget) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/attachments | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathDelete**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidattachmentspathdelete) | **Delete** /repositories/{username}/{repo_slug}/issues/{issue_id}/attachments/{path} | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidattachmentspathget) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/attachments/{path} | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPost**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidattachmentspost) | **Post** /repositories/{username}/{repo_slug}/issues/{issue_id}/attachments | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdChangesChangeIdGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidchangeschangeidget) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/changes/{change_id} | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdChangesGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidchangesget) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/changes | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdChangesPost**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidchangespost) | **Post** /repositories/{username}/{repo_slug}/issues/{issue_id}/changes | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdCommentsCommentIdGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidcommentscommentidget) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/comments/{comment_id} | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdCommentsGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidcommentsget) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/comments | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdDelete**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueiddelete) | **Delete** /repositories/{username}/{repo_slug}/issues/{issue_id} | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidget) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id} | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdPut**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidput) | **Put** /repositories/{username}/{repo_slug}/issues/{issue_id} | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdVoteDelete**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidvotedelete) | **Delete** /repositories/{username}/{repo_slug}/issues/{issue_id}/vote | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdVoteGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidvoteget) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/vote | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdVotePut**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidvoteput) | **Put** /repositories/{username}/{repo_slug}/issues/{issue_id}/vote | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdWatchDelete**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidwatchdelete) | **Delete** /repositories/{username}/{repo_slug}/issues/{issue_id}/watch | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdWatchGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidwatchget) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/watch | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesIssueIdWatchPut**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuesissueidwatchput) | **Put** /repositories/{username}/{repo_slug}/issues/{issue_id}/watch | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugIssuesPost**](docs/IssueTrackerApi.md#repositoriesusernamereposlugissuespost) | **Post** /repositories/{username}/{repo_slug}/issues | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugMilestonesGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugmilestonesget) | **Get** /repositories/{username}/{repo_slug}/milestones | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugMilestonesMilestoneIdGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugmilestonesmilestoneidget) | **Get** /repositories/{username}/{repo_slug}/milestones/{milestone_id} | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugVersionsGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugversionsget) | **Get** /repositories/{username}/{repo_slug}/versions | +*IssueTrackerApi* | [**RepositoriesUsernameRepoSlugVersionsVersionIdGet**](docs/IssueTrackerApi.md#repositoriesusernamereposlugversionsversionidget) | **Get** /repositories/{username}/{repo_slug}/versions/{version_id} | +*PipelinesApi* | [**CreatePipelineForRepository**](docs/PipelinesApi.md#createpipelineforrepository) | **Post** /repositories/{username}/{repo_slug}/pipelines/ | +*PipelinesApi* | [**CreatePipelineVariableForTeam**](docs/PipelinesApi.md#createpipelinevariableforteam) | **Post** /teams/{username}/pipelines_config/variables/ | +*PipelinesApi* | [**CreatePipelineVariableForUser**](docs/PipelinesApi.md#createpipelinevariableforuser) | **Post** /users/{username}/pipelines_config/variables/ | +*PipelinesApi* | [**CreateRepositoryPipelineKnownHost**](docs/PipelinesApi.md#createrepositorypipelineknownhost) | **Post** /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/ | +*PipelinesApi* | [**CreateRepositoryPipelineSchedule**](docs/PipelinesApi.md#createrepositorypipelineschedule) | **Post** /repositories/{username}/{repo_slug}/pipelines_config/schedules/ | +*PipelinesApi* | [**CreateRepositoryPipelineVariable**](docs/PipelinesApi.md#createrepositorypipelinevariable) | **Post** /repositories/{username}/{repo_slug}/pipelines_config/variables/ | +*PipelinesApi* | [**DeletePipelineVariableForTeam**](docs/PipelinesApi.md#deletepipelinevariableforteam) | **Delete** /teams/{username}/pipelines_config/variables/{variable_uuid} | +*PipelinesApi* | [**DeletePipelineVariableForUser**](docs/PipelinesApi.md#deletepipelinevariableforuser) | **Delete** /users/{username}/pipelines_config/variables/{variable_uuid} | +*PipelinesApi* | [**DeleteRepositoryPipelineKeyPair**](docs/PipelinesApi.md#deleterepositorypipelinekeypair) | **Delete** /repositories/{username}/{repo_slug}/pipelines_config/ssh/key_pair | +*PipelinesApi* | [**DeleteRepositoryPipelineKnownHost**](docs/PipelinesApi.md#deleterepositorypipelineknownhost) | **Delete** /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid} | +*PipelinesApi* | [**DeleteRepositoryPipelineSchedule**](docs/PipelinesApi.md#deleterepositorypipelineschedule) | **Delete** /repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid} | +*PipelinesApi* | [**DeleteRepositoryPipelineVariable**](docs/PipelinesApi.md#deleterepositorypipelinevariable) | **Delete** /repositories/{username}/{repo_slug}/pipelines_config/variables/{variable_uuid} | +*PipelinesApi* | [**GetPipelineForRepository**](docs/PipelinesApi.md#getpipelineforrepository) | **Get** /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid} | +*PipelinesApi* | [**GetPipelineStepForRepository**](docs/PipelinesApi.md#getpipelinestepforrepository) | **Get** /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid} | +*PipelinesApi* | [**GetPipelineStepLogForRepository**](docs/PipelinesApi.md#getpipelinesteplogforrepository) | **Get** /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/log | +*PipelinesApi* | [**GetPipelineStepsForRepository**](docs/PipelinesApi.md#getpipelinestepsforrepository) | **Get** /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/ | +*PipelinesApi* | [**GetPipelineVariableForTeam**](docs/PipelinesApi.md#getpipelinevariableforteam) | **Get** /teams/{username}/pipelines_config/variables/{variable_uuid} | +*PipelinesApi* | [**GetPipelineVariableForUser**](docs/PipelinesApi.md#getpipelinevariableforuser) | **Get** /users/{username}/pipelines_config/variables/{variable_uuid} | +*PipelinesApi* | [**GetPipelineVariablesForTeam**](docs/PipelinesApi.md#getpipelinevariablesforteam) | **Get** /teams/{username}/pipelines_config/variables/ | +*PipelinesApi* | [**GetPipelineVariablesForUser**](docs/PipelinesApi.md#getpipelinevariablesforuser) | **Get** /users/{username}/pipelines_config/variables/ | +*PipelinesApi* | [**GetPipelinesForRepository**](docs/PipelinesApi.md#getpipelinesforrepository) | **Get** /repositories/{username}/{repo_slug}/pipelines/ | +*PipelinesApi* | [**GetRepositoryPipelineConfig**](docs/PipelinesApi.md#getrepositorypipelineconfig) | **Get** /repositories/{username}/{repo_slug}/pipelines_config | +*PipelinesApi* | [**GetRepositoryPipelineKnownHost**](docs/PipelinesApi.md#getrepositorypipelineknownhost) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid} | +*PipelinesApi* | [**GetRepositoryPipelineKnownHosts**](docs/PipelinesApi.md#getrepositorypipelineknownhosts) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/ | +*PipelinesApi* | [**GetRepositoryPipelineSchedule**](docs/PipelinesApi.md#getrepositorypipelineschedule) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid} | +*PipelinesApi* | [**GetRepositoryPipelineScheduleExecutions**](docs/PipelinesApi.md#getrepositorypipelinescheduleexecutions) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}/executions/ | +*PipelinesApi* | [**GetRepositoryPipelineSchedules**](docs/PipelinesApi.md#getrepositorypipelineschedules) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/schedules/ | +*PipelinesApi* | [**GetRepositoryPipelineSshKeyPair**](docs/PipelinesApi.md#getrepositorypipelinesshkeypair) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/ssh/key_pair | +*PipelinesApi* | [**GetRepositoryPipelineVariable**](docs/PipelinesApi.md#getrepositorypipelinevariable) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/variables/{variable_uuid} | +*PipelinesApi* | [**GetRepositoryPipelineVariables**](docs/PipelinesApi.md#getrepositorypipelinevariables) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/variables/ | +*PipelinesApi* | [**StopPipeline**](docs/PipelinesApi.md#stoppipeline) | **Post** /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/stopPipeline | +*PipelinesApi* | [**UpdatePipelineVariableForTeam**](docs/PipelinesApi.md#updatepipelinevariableforteam) | **Put** /teams/{username}/pipelines_config/variables/{variable_uuid} | +*PipelinesApi* | [**UpdatePipelineVariableForUser**](docs/PipelinesApi.md#updatepipelinevariableforuser) | **Put** /users/{username}/pipelines_config/variables/{variable_uuid} | +*PipelinesApi* | [**UpdateRepositoryBuildNumber**](docs/PipelinesApi.md#updaterepositorybuildnumber) | **Put** /repositories/{username}/{repo_slug}/pipelines_config/build_number | +*PipelinesApi* | [**UpdateRepositoryPipelineConfig**](docs/PipelinesApi.md#updaterepositorypipelineconfig) | **Put** /repositories/{username}/{repo_slug}/pipelines_config | +*PipelinesApi* | [**UpdateRepositoryPipelineKeyPair**](docs/PipelinesApi.md#updaterepositorypipelinekeypair) | **Put** /repositories/{username}/{repo_slug}/pipelines_config/ssh/key_pair | +*PipelinesApi* | [**UpdateRepositoryPipelineKnownHost**](docs/PipelinesApi.md#updaterepositorypipelineknownhost) | **Put** /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid} | +*PipelinesApi* | [**UpdateRepositoryPipelineSchedule**](docs/PipelinesApi.md#updaterepositorypipelineschedule) | **Put** /repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid} | +*PipelinesApi* | [**UpdateRepositoryPipelineVariable**](docs/PipelinesApi.md#updaterepositorypipelinevariable) | **Put** /repositories/{username}/{repo_slug}/pipelines_config/variables/{variable_uuid} | +*ProjectsApi* | [**TeamsUsernameProjectsGet**](docs/ProjectsApi.md#teamsusernameprojectsget) | **Get** /teams/{username}/projects/ | +*ProjectsApi* | [**TeamsUsernameProjectsPost**](docs/ProjectsApi.md#teamsusernameprojectspost) | **Post** /teams/{username}/projects/ | +*ProjectsApi* | [**TeamsUsernameProjectsProjectKeyDelete**](docs/ProjectsApi.md#teamsusernameprojectsprojectkeydelete) | **Delete** /teams/{username}/projects/{project_key} | +*ProjectsApi* | [**TeamsUsernameProjectsProjectKeyGet**](docs/ProjectsApi.md#teamsusernameprojectsprojectkeyget) | **Get** /teams/{username}/projects/{project_key} | +*ProjectsApi* | [**TeamsUsernameProjectsProjectKeyPut**](docs/ProjectsApi.md#teamsusernameprojectsprojectkeyput) | **Put** /teams/{username}/projects/{project_key} | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugDefaultReviewersGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugdefaultreviewersget) | **Get** /repositories/{username}/{repo_slug}/default-reviewers | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameDelete**](docs/PullrequestsApi.md#repositoriesusernamereposlugdefaultreviewerstargetusernamedelete) | **Delete** /repositories/{username}/{repo_slug}/default-reviewers/{target_username} | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugdefaultreviewerstargetusernameget) | **Get** /repositories/{username}/{repo_slug}/default-reviewers/{target_username} | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernamePut**](docs/PullrequestsApi.md#repositoriesusernamereposlugdefaultreviewerstargetusernameput) | **Put** /repositories/{username}/{repo_slug}/default-reviewers/{target_username} | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsActivityGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestsactivityget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/activity | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestsget) | **Get** /repositories/{username}/{repo_slug}/pullrequests | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPost**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspost) | **Post** /repositories/{username}/{repo_slug}/pullrequests | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdActivityGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidactivityget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/activity | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApproveDelete**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidapprovedelete) | **Delete** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/approve | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApprovePost**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidapprovepost) | **Post** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/approve | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsCommentIdGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidcommentscommentidget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id} | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidcommentsget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/comments | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommitsGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidcommitsget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/commits | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDeclinePost**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestiddeclinepost) | **Post** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/decline | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDiffGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestiddiffget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/diff | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id} | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdMergePost**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidmergepost) | **Post** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/merge | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPatchGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidpatchget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/patch | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPut**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidput) | **Put** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id} | +*PullrequestsApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet**](docs/PullrequestsApi.md#repositoriesusernamereposlugpullrequestspullrequestidstatusesget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/statuses | +*RefsApi* | [**RepositoriesUsernameRepoSlugRefsBranchesGet**](docs/RefsApi.md#repositoriesusernamereposlugrefsbranchesget) | **Get** /repositories/{username}/{repo_slug}/refs/branches | +*RefsApi* | [**RepositoriesUsernameRepoSlugRefsBranchesNameGet**](docs/RefsApi.md#repositoriesusernamereposlugrefsbranchesnameget) | **Get** /repositories/{username}/{repo_slug}/refs/branches/{name} | +*RefsApi* | [**RepositoriesUsernameRepoSlugRefsGet**](docs/RefsApi.md#repositoriesusernamereposlugrefsget) | **Get** /repositories/{username}/{repo_slug}/refs | +*RefsApi* | [**RepositoriesUsernameRepoSlugRefsTagsGet**](docs/RefsApi.md#repositoriesusernamereposlugrefstagsget) | **Get** /repositories/{username}/{repo_slug}/refs/tags | +*RefsApi* | [**RepositoriesUsernameRepoSlugRefsTagsNameGet**](docs/RefsApi.md#repositoriesusernamereposlugrefstagsnameget) | **Get** /repositories/{username}/{repo_slug}/refs/tags/{name} | +*RefsApi* | [**RepositoriesUsernameRepoSlugRefsTagsPost**](docs/RefsApi.md#repositoriesusernamereposlugrefstagspost) | **Post** /repositories/{username}/{repo_slug}/refs/tags | +*RepositoriesApi* | [**RepositoriesGet**](docs/RepositoriesApi.md#repositoriesget) | **Get** /repositories | +*RepositoriesApi* | [**RepositoriesUsernameGet**](docs/RepositoriesApi.md#repositoriesusernameget) | **Get** /repositories/{username} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet**](docs/RepositoriesApi.md#repositoriesusernamereposlugcommitnodestatusesbuildkeyget) | **Get** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut**](docs/RepositoriesApi.md#repositoriesusernamereposlugcommitnodestatusesbuildkeyput) | **Put** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost**](docs/RepositoriesApi.md#repositoriesusernamereposlugcommitnodestatusesbuildpost) | **Post** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugCommitNodeStatusesGet**](docs/RepositoriesApi.md#repositoriesusernamereposlugcommitnodestatusesget) | **Get** /repositories/{username}/{repo_slug}/commit/{node}/statuses | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugDelete**](docs/RepositoriesApi.md#repositoriesusernamereposlugdelete) | **Delete** /repositories/{username}/{repo_slug} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugFilehistoryNodePathGet**](docs/RepositoriesApi.md#repositoriesusernamereposlugfilehistorynodepathget) | **Get** /repositories/{username}/{repo_slug}/filehistory/{node}/{path} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugForksGet**](docs/RepositoriesApi.md#repositoriesusernamereposlugforksget) | **Get** /repositories/{username}/{repo_slug}/forks | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugForksPost**](docs/RepositoriesApi.md#repositoriesusernamereposlugforkspost) | **Post** /repositories/{username}/{repo_slug}/forks | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugGet**](docs/RepositoriesApi.md#repositoriesusernamereposlugget) | **Get** /repositories/{username}/{repo_slug} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugHooksGet**](docs/RepositoriesApi.md#repositoriesusernamereposlughooksget) | **Get** /repositories/{username}/{repo_slug}/hooks | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugHooksPost**](docs/RepositoriesApi.md#repositoriesusernamereposlughookspost) | **Post** /repositories/{username}/{repo_slug}/hooks | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugHooksUidDelete**](docs/RepositoriesApi.md#repositoriesusernamereposlughooksuiddelete) | **Delete** /repositories/{username}/{repo_slug}/hooks/{uid} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugHooksUidGet**](docs/RepositoriesApi.md#repositoriesusernamereposlughooksuidget) | **Get** /repositories/{username}/{repo_slug}/hooks/{uid} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugHooksUidPut**](docs/RepositoriesApi.md#repositoriesusernamereposlughooksuidput) | **Put** /repositories/{username}/{repo_slug}/hooks/{uid} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugPost**](docs/RepositoriesApi.md#repositoriesusernamereposlugpost) | **Post** /repositories/{username}/{repo_slug} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet**](docs/RepositoriesApi.md#repositoriesusernamereposlugpullrequestspullrequestidstatusesget) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/statuses | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugPut**](docs/RepositoriesApi.md#repositoriesusernamereposlugput) | **Put** /repositories/{username}/{repo_slug} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugSrcGet**](docs/RepositoriesApi.md#repositoriesusernamereposlugsrcget) | **Get** /repositories/{username}/{repo_slug}/src | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugSrcNodePathGet**](docs/RepositoriesApi.md#repositoriesusernamereposlugsrcnodepathget) | **Get** /repositories/{username}/{repo_slug}/src/{node}/{path} | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugSrcPost**](docs/RepositoriesApi.md#repositoriesusernamereposlugsrcpost) | **Post** /repositories/{username}/{repo_slug}/src | +*RepositoriesApi* | [**RepositoriesUsernameRepoSlugWatchersGet**](docs/RepositoriesApi.md#repositoriesusernamereposlugwatchersget) | **Get** /repositories/{username}/{repo_slug}/watchers | +*RepositoriesApi* | [**UserPermissionsRepositoriesGet**](docs/RepositoriesApi.md#userpermissionsrepositoriesget) | **Get** /user/permissions/repositories | +*SnippetsApi* | [**SnippetsGet**](docs/SnippetsApi.md#snippetsget) | **Get** /snippets | +*SnippetsApi* | [**SnippetsPost**](docs/SnippetsApi.md#snippetspost) | **Post** /snippets | +*SnippetsApi* | [**SnippetsUsernameEncodedIdCommentsCommentIdDelete**](docs/SnippetsApi.md#snippetsusernameencodedidcommentscommentiddelete) | **Delete** /snippets/{username}/{encoded_id}/comments/{comment_id} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdCommentsCommentIdGet**](docs/SnippetsApi.md#snippetsusernameencodedidcommentscommentidget) | **Get** /snippets/{username}/{encoded_id}/comments/{comment_id} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdCommentsCommentIdPut**](docs/SnippetsApi.md#snippetsusernameencodedidcommentscommentidput) | **Put** /snippets/{username}/{encoded_id}/comments/{comment_id} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdCommentsGet**](docs/SnippetsApi.md#snippetsusernameencodedidcommentsget) | **Get** /snippets/{username}/{encoded_id}/comments | +*SnippetsApi* | [**SnippetsUsernameEncodedIdCommentsPost**](docs/SnippetsApi.md#snippetsusernameencodedidcommentspost) | **Post** /snippets/{username}/{encoded_id}/comments | +*SnippetsApi* | [**SnippetsUsernameEncodedIdCommitsGet**](docs/SnippetsApi.md#snippetsusernameencodedidcommitsget) | **Get** /snippets/{username}/{encoded_id}/commits | +*SnippetsApi* | [**SnippetsUsernameEncodedIdCommitsRevisionGet**](docs/SnippetsApi.md#snippetsusernameencodedidcommitsrevisionget) | **Get** /snippets/{username}/{encoded_id}/commits/{revision} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdDelete**](docs/SnippetsApi.md#snippetsusernameencodediddelete) | **Delete** /snippets/{username}/{encoded_id} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdGet**](docs/SnippetsApi.md#snippetsusernameencodedidget) | **Get** /snippets/{username}/{encoded_id} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdNodeIdDelete**](docs/SnippetsApi.md#snippetsusernameencodedidnodeiddelete) | **Delete** /snippets/{username}/{encoded_id}/{node_id} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdNodeIdFilesPathGet**](docs/SnippetsApi.md#snippetsusernameencodedidnodeidfilespathget) | **Get** /snippets/{username}/{encoded_id}/{node_id}/files/{path} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdNodeIdGet**](docs/SnippetsApi.md#snippetsusernameencodedidnodeidget) | **Get** /snippets/{username}/{encoded_id}/{node_id} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdNodeIdPut**](docs/SnippetsApi.md#snippetsusernameencodedidnodeidput) | **Put** /snippets/{username}/{encoded_id}/{node_id} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdPut**](docs/SnippetsApi.md#snippetsusernameencodedidput) | **Put** /snippets/{username}/{encoded_id} | +*SnippetsApi* | [**SnippetsUsernameEncodedIdRevisionDiffGet**](docs/SnippetsApi.md#snippetsusernameencodedidrevisiondiffget) | **Get** /snippets/{username}/{encoded_id}/{revision}/diff | +*SnippetsApi* | [**SnippetsUsernameEncodedIdRevisionPatchGet**](docs/SnippetsApi.md#snippetsusernameencodedidrevisionpatchget) | **Get** /snippets/{username}/{encoded_id}/{revision}/patch | +*SnippetsApi* | [**SnippetsUsernameEncodedIdWatchDelete**](docs/SnippetsApi.md#snippetsusernameencodedidwatchdelete) | **Delete** /snippets/{username}/{encoded_id}/watch | +*SnippetsApi* | [**SnippetsUsernameEncodedIdWatchGet**](docs/SnippetsApi.md#snippetsusernameencodedidwatchget) | **Get** /snippets/{username}/{encoded_id}/watch | +*SnippetsApi* | [**SnippetsUsernameEncodedIdWatchPut**](docs/SnippetsApi.md#snippetsusernameencodedidwatchput) | **Put** /snippets/{username}/{encoded_id}/watch | +*SnippetsApi* | [**SnippetsUsernameEncodedIdWatchersGet**](docs/SnippetsApi.md#snippetsusernameencodedidwatchersget) | **Get** /snippets/{username}/{encoded_id}/watchers | +*SnippetsApi* | [**SnippetsUsernameGet**](docs/SnippetsApi.md#snippetsusernameget) | **Get** /snippets/{username} | +*SnippetsApi* | [**SnippetsUsernamePost**](docs/SnippetsApi.md#snippetsusernamepost) | **Post** /snippets/{username} | +*SourceApi* | [**RepositoriesUsernameRepoSlugFilehistoryNodePathGet**](docs/SourceApi.md#repositoriesusernamereposlugfilehistorynodepathget) | **Get** /repositories/{username}/{repo_slug}/filehistory/{node}/{path} | +*SourceApi* | [**RepositoriesUsernameRepoSlugSrcGet**](docs/SourceApi.md#repositoriesusernamereposlugsrcget) | **Get** /repositories/{username}/{repo_slug}/src | +*SourceApi* | [**RepositoriesUsernameRepoSlugSrcNodePathGet**](docs/SourceApi.md#repositoriesusernamereposlugsrcnodepathget) | **Get** /repositories/{username}/{repo_slug}/src/{node}/{path} | +*SourceApi* | [**RepositoriesUsernameRepoSlugSrcPost**](docs/SourceApi.md#repositoriesusernamereposlugsrcpost) | **Post** /repositories/{username}/{repo_slug}/src | +*SshApi* | [**UsersUsernameSshKeysDelete**](docs/SshApi.md#usersusernamesshkeysdelete) | **Delete** /users/{username}/ssh-keys/ | +*SshApi* | [**UsersUsernameSshKeysGet**](docs/SshApi.md#usersusernamesshkeysget) | **Get** /users/{username}/ssh-keys/ | +*SshApi* | [**UsersUsernameSshKeysGet_0**](docs/SshApi.md#usersusernamesshkeysget_0) | **Get** /users/{username}/ssh-keys | +*SshApi* | [**UsersUsernameSshKeysPost**](docs/SshApi.md#usersusernamesshkeyspost) | **Post** /users/{username}/ssh-keys | +*SshApi* | [**UsersUsernameSshKeysPut**](docs/SshApi.md#usersusernamesshkeysput) | **Put** /users/{username}/ssh-keys/ | +*TeamsApi* | [**TeamsGet**](docs/TeamsApi.md#teamsget) | **Get** /teams | +*TeamsApi* | [**TeamsUsernameFollowersGet**](docs/TeamsApi.md#teamsusernamefollowersget) | **Get** /teams/{username}/followers | +*TeamsApi* | [**TeamsUsernameFollowingGet**](docs/TeamsApi.md#teamsusernamefollowingget) | **Get** /teams/{username}/following | +*TeamsApi* | [**TeamsUsernameGet**](docs/TeamsApi.md#teamsusernameget) | **Get** /teams/{username} | +*TeamsApi* | [**TeamsUsernameHooksGet**](docs/TeamsApi.md#teamsusernamehooksget) | **Get** /teams/{username}/hooks | +*TeamsApi* | [**TeamsUsernameHooksPost**](docs/TeamsApi.md#teamsusernamehookspost) | **Post** /teams/{username}/hooks | +*TeamsApi* | [**TeamsUsernameHooksUidDelete**](docs/TeamsApi.md#teamsusernamehooksuiddelete) | **Delete** /teams/{username}/hooks/{uid} | +*TeamsApi* | [**TeamsUsernameHooksUidGet**](docs/TeamsApi.md#teamsusernamehooksuidget) | **Get** /teams/{username}/hooks/{uid} | +*TeamsApi* | [**TeamsUsernameHooksUidPut**](docs/TeamsApi.md#teamsusernamehooksuidput) | **Put** /teams/{username}/hooks/{uid} | +*TeamsApi* | [**TeamsUsernameMembersGet**](docs/TeamsApi.md#teamsusernamemembersget) | **Get** /teams/{username}/members | +*TeamsApi* | [**TeamsUsernameRepositoriesGet**](docs/TeamsApi.md#teamsusernamerepositoriesget) | **Get** /teams/{username}/repositories | +*TeamsApi* | [**UsersUsernameRepositoriesGet**](docs/TeamsApi.md#usersusernamerepositoriesget) | **Get** /users/{username}/repositories | +*UsersApi* | [**TeamsUsernameRepositoriesGet**](docs/UsersApi.md#teamsusernamerepositoriesget) | **Get** /teams/{username}/repositories | +*UsersApi* | [**UserEmailsEmailGet**](docs/UsersApi.md#useremailsemailget) | **Get** /user/emails/{email} | +*UsersApi* | [**UserEmailsGet**](docs/UsersApi.md#useremailsget) | **Get** /user/emails | +*UsersApi* | [**UserGet**](docs/UsersApi.md#userget) | **Get** /user | +*UsersApi* | [**UsersUsernameFollowersGet**](docs/UsersApi.md#usersusernamefollowersget) | **Get** /users/{username}/followers | +*UsersApi* | [**UsersUsernameFollowingGet**](docs/UsersApi.md#usersusernamefollowingget) | **Get** /users/{username}/following | +*UsersApi* | [**UsersUsernameGet**](docs/UsersApi.md#usersusernameget) | **Get** /users/{username} | +*UsersApi* | [**UsersUsernameHooksGet**](docs/UsersApi.md#usersusernamehooksget) | **Get** /users/{username}/hooks | +*UsersApi* | [**UsersUsernameHooksPost**](docs/UsersApi.md#usersusernamehookspost) | **Post** /users/{username}/hooks | +*UsersApi* | [**UsersUsernameHooksUidDelete**](docs/UsersApi.md#usersusernamehooksuiddelete) | **Delete** /users/{username}/hooks/{uid} | +*UsersApi* | [**UsersUsernameHooksUidGet**](docs/UsersApi.md#usersusernamehooksuidget) | **Get** /users/{username}/hooks/{uid} | +*UsersApi* | [**UsersUsernameHooksUidPut**](docs/UsersApi.md#usersusernamehooksuidput) | **Put** /users/{username}/hooks/{uid} | +*UsersApi* | [**UsersUsernameRepositoriesGet**](docs/UsersApi.md#usersusernamerepositoriesget) | **Get** /users/{username}/repositories | +*WebhooksApi* | [**HookEventsGet**](docs/WebhooksApi.md#hookeventsget) | **Get** /hook_events | +*WebhooksApi* | [**HookEventsSubjectTypeGet**](docs/WebhooksApi.md#hookeventssubjecttypeget) | **Get** /hook_events/{subject_type} | +*WebhooksApi* | [**RepositoriesUsernameRepoSlugHooksGet**](docs/WebhooksApi.md#repositoriesusernamereposlughooksget) | **Get** /repositories/{username}/{repo_slug}/hooks | +*WebhooksApi* | [**RepositoriesUsernameRepoSlugHooksPost**](docs/WebhooksApi.md#repositoriesusernamereposlughookspost) | **Post** /repositories/{username}/{repo_slug}/hooks | +*WebhooksApi* | [**RepositoriesUsernameRepoSlugHooksUidDelete**](docs/WebhooksApi.md#repositoriesusernamereposlughooksuiddelete) | **Delete** /repositories/{username}/{repo_slug}/hooks/{uid} | +*WebhooksApi* | [**RepositoriesUsernameRepoSlugHooksUidGet**](docs/WebhooksApi.md#repositoriesusernamereposlughooksuidget) | **Get** /repositories/{username}/{repo_slug}/hooks/{uid} | +*WebhooksApi* | [**RepositoriesUsernameRepoSlugHooksUidPut**](docs/WebhooksApi.md#repositoriesusernamereposlughooksuidput) | **Put** /repositories/{username}/{repo_slug}/hooks/{uid} | +*WebhooksApi* | [**TeamsUsernameHooksGet**](docs/WebhooksApi.md#teamsusernamehooksget) | **Get** /teams/{username}/hooks | +*WebhooksApi* | [**TeamsUsernameHooksPost**](docs/WebhooksApi.md#teamsusernamehookspost) | **Post** /teams/{username}/hooks | +*WebhooksApi* | [**TeamsUsernameHooksUidDelete**](docs/WebhooksApi.md#teamsusernamehooksuiddelete) | **Delete** /teams/{username}/hooks/{uid} | +*WebhooksApi* | [**TeamsUsernameHooksUidGet**](docs/WebhooksApi.md#teamsusernamehooksuidget) | **Get** /teams/{username}/hooks/{uid} | +*WebhooksApi* | [**TeamsUsernameHooksUidPut**](docs/WebhooksApi.md#teamsusernamehooksuidput) | **Put** /teams/{username}/hooks/{uid} | +*WebhooksApi* | [**UsersUsernameHooksGet**](docs/WebhooksApi.md#usersusernamehooksget) | **Get** /users/{username}/hooks | +*WebhooksApi* | [**UsersUsernameHooksPost**](docs/WebhooksApi.md#usersusernamehookspost) | **Post** /users/{username}/hooks | +*WebhooksApi* | [**UsersUsernameHooksUidDelete**](docs/WebhooksApi.md#usersusernamehooksuiddelete) | **Delete** /users/{username}/hooks/{uid} | +*WebhooksApi* | [**UsersUsernameHooksUidGet**](docs/WebhooksApi.md#usersusernamehooksuidget) | **Get** /users/{username}/hooks/{uid} | +*WebhooksApi* | [**UsersUsernameHooksUidPut**](docs/WebhooksApi.md#usersusernamehooksuidput) | **Put** /users/{username}/hooks/{uid} | + + +## Documentation For Models + + - [AccountLinks](docs/AccountLinks.md) + - [CommentInline](docs/CommentInline.md) + - [CommentLinks](docs/CommentLinks.md) + - [CommitFile](docs/CommitFile.md) + - [CommitLinks](docs/CommitLinks.md) + - [CommitstatusLinks](docs/CommitstatusLinks.md) + - [ErrorError](docs/ErrorError.md) + - [GroupLinks](docs/GroupLinks.md) + - [HookEvent](docs/HookEvent.md) + - [IssueChange](docs/IssueChange.md) + - [IssueChangeChanges](docs/IssueChangeChanges.md) + - [IssueChangeChangesAssignee](docs/IssueChangeChangesAssignee.md) + - [IssueChangeLinks](docs/IssueChangeLinks.md) + - [IssueLinks](docs/IssueLinks.md) + - [MilestoneLinks](docs/MilestoneLinks.md) + - [MilestoneLinksSelf](docs/MilestoneLinksSelf.md) + - [ModelError](docs/ModelError.md) + - [Object](docs/Object.md) + - [Page](docs/Page.md) + - [PaginatedBranchrestrictions](docs/PaginatedBranchrestrictions.md) + - [PaginatedCommitstatuses](docs/PaginatedCommitstatuses.md) + - [PaginatedComponents](docs/PaginatedComponents.md) + - [PaginatedFiles](docs/PaginatedFiles.md) + - [PaginatedHookEvents](docs/PaginatedHookEvents.md) + - [PaginatedIssueAttachments](docs/PaginatedIssueAttachments.md) + - [PaginatedIssues](docs/PaginatedIssues.md) + - [PaginatedLogEntries](docs/PaginatedLogEntries.md) + - [PaginatedMilestones](docs/PaginatedMilestones.md) + - [PaginatedPipelineKnownHosts](docs/PaginatedPipelineKnownHosts.md) + - [PaginatedPipelineScheduleExecutions](docs/PaginatedPipelineScheduleExecutions.md) + - [PaginatedPipelineSchedules](docs/PaginatedPipelineSchedules.md) + - [PaginatedPipelineSteps](docs/PaginatedPipelineSteps.md) + - [PaginatedPipelineVariables](docs/PaginatedPipelineVariables.md) + - [PaginatedPipelines](docs/PaginatedPipelines.md) + - [PaginatedProjects](docs/PaginatedProjects.md) + - [PaginatedPullrequestComments](docs/PaginatedPullrequestComments.md) + - [PaginatedPullrequests](docs/PaginatedPullrequests.md) + - [PaginatedRepositories](docs/PaginatedRepositories.md) + - [PaginatedRepositoryPermissions](docs/PaginatedRepositoryPermissions.md) + - [PaginatedSnippetComments](docs/PaginatedSnippetComments.md) + - [PaginatedSnippetCommit](docs/PaginatedSnippetCommit.md) + - [PaginatedSnippets](docs/PaginatedSnippets.md) + - [PaginatedSshUserKeys](docs/PaginatedSshUserKeys.md) + - [PaginatedTeamPermissions](docs/PaginatedTeamPermissions.md) + - [PaginatedTeams](docs/PaginatedTeams.md) + - [PaginatedTreeentries](docs/PaginatedTreeentries.md) + - [PaginatedUsers](docs/PaginatedUsers.md) + - [PaginatedVersions](docs/PaginatedVersions.md) + - [PaginatedWebhookSubscriptions](docs/PaginatedWebhookSubscriptions.md) + - [PipelineCommand](docs/PipelineCommand.md) + - [PipelineImage](docs/PipelineImage.md) + - [PipelineLogRange](docs/PipelineLogRange.md) + - [ProjectLinks](docs/ProjectLinks.md) + - [PullrequestEndpoint](docs/PullrequestEndpoint.md) + - [PullrequestEndpointBranch](docs/PullrequestEndpointBranch.md) + - [PullrequestLinks](docs/PullrequestLinks.md) + - [PullrequestMergeCommit](docs/PullrequestMergeCommit.md) + - [PullrequestMergeParameters](docs/PullrequestMergeParameters.md) + - [PullrequestSummary](docs/PullrequestSummary.md) + - [RepositoryLinks](docs/RepositoryLinks.md) + - [RepositoryPermission](docs/RepositoryPermission.md) + - [SearchResult](docs/SearchResult.md) + - [SnippetCommitLinks](docs/SnippetCommitLinks.md) + - [SubjectTypes](docs/SubjectTypes.md) + - [SubjectTypesRepository](docs/SubjectTypesRepository.md) + - [Tag](docs/Tag.md) + - [TagLinks](docs/TagLinks.md) + - [TeamPermission](docs/TeamPermission.md) + - [Treeentry](docs/Treeentry.md) + - [Account](docs/Account.md) + - [Author](docs/Author.md) + - [BaseCommit](docs/BaseCommit.md) + - [Branchrestriction](docs/Branchrestriction.md) + - [Comment](docs/Comment.md) + - [Commitstatus](docs/Commitstatus.md) + - [Component](docs/Component.md) + - [Group](docs/Group.md) + - [Issue](docs/Issue.md) + - [IssueAttachment](docs/IssueAttachment.md) + - [Milestone](docs/Milestone.md) + - [Participant](docs/Participant.md) + - [Pipeline](docs/Pipeline.md) + - [PipelineBuildNumber](docs/PipelineBuildNumber.md) + - [PipelineError](docs/PipelineError.md) + - [PipelineKnownHost](docs/PipelineKnownHost.md) + - [PipelineSchedule](docs/PipelineSchedule.md) + - [PipelineScheduleExecution](docs/PipelineScheduleExecution.md) + - [PipelineSelector](docs/PipelineSelector.md) + - [PipelineSshKeyPair](docs/PipelineSshKeyPair.md) + - [PipelineSshPublicKey](docs/PipelineSshPublicKey.md) + - [PipelineState](docs/PipelineState.md) + - [PipelineStateCompletedResult](docs/PipelineStateCompletedResult.md) + - [PipelineStateInProgressStage](docs/PipelineStateInProgressStage.md) + - [PipelineStep](docs/PipelineStep.md) + - [PipelineStepError](docs/PipelineStepError.md) + - [PipelineStepState](docs/PipelineStepState.md) + - [PipelineStepStateCompletedResult](docs/PipelineStepStateCompletedResult.md) + - [PipelineTarget](docs/PipelineTarget.md) + - [PipelineTrigger](docs/PipelineTrigger.md) + - [PipelineVariable](docs/PipelineVariable.md) + - [PipelinesConfig](docs/PipelinesConfig.md) + - [Project](docs/Project.md) + - [Pullrequest](docs/Pullrequest.md) + - [Repository](docs/Repository.md) + - [Snippet](docs/Snippet.md) + - [SnippetComment](docs/SnippetComment.md) + - [SshKey](docs/SshKey.md) + - [Version](docs/Version.md) + - [WebhookSubscription](docs/WebhookSubscription.md) + - [Commit](docs/Commit.md) + - [PipelineCommitTarget](docs/PipelineCommitTarget.md) + - [PipelineRefTarget](docs/PipelineRefTarget.md) + - [PipelineScheduleExecutionErrored](docs/PipelineScheduleExecutionErrored.md) + - [PipelineScheduleExecutionExecuted](docs/PipelineScheduleExecutionExecuted.md) + - [PipelineStateCompleted](docs/PipelineStateCompleted.md) + - [PipelineStateCompletedError](docs/PipelineStateCompletedError.md) + - [PipelineStateCompletedExpired](docs/PipelineStateCompletedExpired.md) + - [PipelineStateCompletedFailed](docs/PipelineStateCompletedFailed.md) + - [PipelineStateCompletedStopped](docs/PipelineStateCompletedStopped.md) + - [PipelineStateCompletedSuccessful](docs/PipelineStateCompletedSuccessful.md) + - [PipelineStateInProgress](docs/PipelineStateInProgress.md) + - [PipelineStateInProgressPaused](docs/PipelineStateInProgressPaused.md) + - [PipelineStateInProgressRunning](docs/PipelineStateInProgressRunning.md) + - [PipelineStatePending](docs/PipelineStatePending.md) + - [PipelineStepStateCompleted](docs/PipelineStepStateCompleted.md) + - [PipelineStepStateCompletedError](docs/PipelineStepStateCompletedError.md) + - [PipelineStepStateCompletedExpired](docs/PipelineStepStateCompletedExpired.md) + - [PipelineStepStateCompletedFailed](docs/PipelineStepStateCompletedFailed.md) + - [PipelineStepStateCompletedNotRun](docs/PipelineStepStateCompletedNotRun.md) + - [PipelineStepStateCompletedStopped](docs/PipelineStepStateCompletedStopped.md) + - [PipelineStepStateCompletedSuccessful](docs/PipelineStepStateCompletedSuccessful.md) + - [PipelineStepStateInProgress](docs/PipelineStepStateInProgress.md) + - [PipelineStepStatePending](docs/PipelineStepStatePending.md) + - [PipelineStepStateReady](docs/PipelineStepStateReady.md) + - [PipelineTriggerManual](docs/PipelineTriggerManual.md) + - [PipelineTriggerPush](docs/PipelineTriggerPush.md) + - [PullrequestComment](docs/PullrequestComment.md) + - [SnippetCommit](docs/SnippetCommit.md) + - [SshAccountKey](docs/SshAccountKey.md) + - [Team](docs/Team.md) + - [User](docs/User.md) + + +## Documentation For Authorization + +## api_key +- **Type**: API key + +Example +``` + auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. + }) + r, err := client.Service.Operation(auth, args) +``` +## basic +- **Type**: HTTP basic authentication + +Example +``` + auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ + UserName: "username", + Password: "password", + }) + r, err := client.Service.Operation(auth, args) +``` +## oauth2 +- **Type**: OAuth +- **Flow**: accessCode +- **Authorization URL**: https://bitbucket.org/site/oauth2/authorize +- **Scopes**: + - **wiki**: Read and modify your repositories' wikis + - **pullrequest:write**: Read and modify your repositories and their pull requests + - **pipeline:variable**: Access your repositories' build pipelines and configure their variables + - **project:write**: Read and modify your team's project settings, and read and transfer repositories within your team's projects + - **pipeline:write**: Access and rerun your repositories' build pipelines + - **snippet**: Read your snippets + - **repository:delete**: Delete your repositories + - **repository:write**: Read and modify your repositories + - **issue**: Read your repositories' issues + - **email**: Read your account's primary email address + - **repository**: Read your repositories + - **issue:write**: Read and modify your repositories' issues + - **webhook**: Read and modify your repositories' webhooks + - **pipeline**: Access your repositories' build pipelines + - **snippet:write**: Read and modify your snippets + - **account**: Read your account information + - **repository:admin**: Administer your repositories + - **pullrequest**: Read your repositories and their pull requests + - **project**: Read your team's project settings and read repositories contained within your team's projects + - **team**: Read your team membership information + - **team:write**: Read and modify your team membership information + - **account:write**: Read and modify your account information + +Example +``` + auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") + r, err := client.Service.Operation(auth, args) +``` + +Or via OAuth2 module to automatically refresh tokens and perform user authentication. +``` + import "golang.org/x/oauth2" + + / .. Perform OAuth2 round trip request and obtain a token .. // + + tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) + auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) + r, err := client.Service.Operation(auth, args) +``` + +## Author + +support@bitbucket.org + diff --git a/account.go b/account.go new file mode 100644 index 0000000..d71d77f --- /dev/null +++ b/account.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Account struct { + + Type_ string `json:"type"` + + Links *AccountLinks `json:"links,omitempty"` + + Username string `json:"username,omitempty"` + + DisplayName string `json:"display_name,omitempty"` + + Website string `json:"website,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + Uuid string `json:"uuid,omitempty"` +} diff --git a/account_links.go b/account_links.go new file mode 100644 index 0000000..aafeee9 --- /dev/null +++ b/account_links.go @@ -0,0 +1,26 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type AccountLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Html *MilestoneLinksSelf `json:"html,omitempty"` + + Avatar *MilestoneLinksSelf `json:"avatar,omitempty"` + + Followers *MilestoneLinksSelf `json:"followers,omitempty"` + + Following *MilestoneLinksSelf `json:"following,omitempty"` + + Repositories *MilestoneLinksSelf `json:"repositories,omitempty"` +} diff --git a/addon_api.go b/addon_api.go new file mode 100644 index 0000000..9831f37 --- /dev/null +++ b/addon_api.go @@ -0,0 +1,794 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type AddonApiService service + + +/* AddonApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @return ModelError*/ +func (a *AddonApiService) AddonDelete(ctx context.Context) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/addon" + + 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* AddonApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @return ModelError*/ +func (a *AddonApiService) AddonLinkersGet(ctx context.Context) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/addon/linkers" + + 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* AddonApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param linkerKey + @return ModelError*/ +func (a *AddonApiService) AddonLinkersLinkerKeyGet(ctx context.Context, linkerKey string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/addon/linkers/{linker_key}" + localVarPath = strings.Replace(localVarPath, "{"+"linker_key"+"}", fmt.Sprintf("%v", linkerKey), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* AddonApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param linkerKey + @return ModelError*/ +func (a *AddonApiService) AddonLinkersLinkerKeyValuesDelete(ctx context.Context, linkerKey string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/addon/linkers/{linker_key}/values" + localVarPath = strings.Replace(localVarPath, "{"+"linker_key"+"}", fmt.Sprintf("%v", linkerKey), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* AddonApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param linkerKey + @return ModelError*/ +func (a *AddonApiService) AddonLinkersLinkerKeyValuesDelete_1(ctx context.Context, linkerKey string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/addon/linkers/{linker_key}/values/" + localVarPath = strings.Replace(localVarPath, "{"+"linker_key"+"}", fmt.Sprintf("%v", linkerKey), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* AddonApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param linkerKey + @return ModelError*/ +func (a *AddonApiService) AddonLinkersLinkerKeyValuesGet(ctx context.Context, linkerKey string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/addon/linkers/{linker_key}/values" + localVarPath = strings.Replace(localVarPath, "{"+"linker_key"+"}", fmt.Sprintf("%v", linkerKey), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* AddonApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param linkerKey + @return ModelError*/ +func (a *AddonApiService) AddonLinkersLinkerKeyValuesGet_2(ctx context.Context, linkerKey string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/addon/linkers/{linker_key}/values/" + localVarPath = strings.Replace(localVarPath, "{"+"linker_key"+"}", fmt.Sprintf("%v", linkerKey), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* AddonApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param linkerKey + @return ModelError*/ +func (a *AddonApiService) AddonLinkersLinkerKeyValuesPost(ctx context.Context, linkerKey string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/addon/linkers/{linker_key}/values" + localVarPath = strings.Replace(localVarPath, "{"+"linker_key"+"}", fmt.Sprintf("%v", linkerKey), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* AddonApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param linkerKey + @return ModelError*/ +func (a *AddonApiService) AddonLinkersLinkerKeyValuesPut(ctx context.Context, linkerKey string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/addon/linkers/{linker_key}/values" + localVarPath = strings.Replace(localVarPath, "{"+"linker_key"+"}", fmt.Sprintf("%v", linkerKey), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* AddonApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @return ModelError*/ +func (a *AddonApiService) AddonPut(ctx context.Context) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/addon" + + 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/api/swagger.yaml b/api/swagger.yaml new file mode 100644 index 0000000..0f6a3ff --- /dev/null +++ b/api/swagger.yaml @@ -0,0 +1,12872 @@ +--- +swagger: "2.0" +info: + description: "Code against the Bitbucket API to automate simple tasks, embed Bitbucket\ + \ data into your own site, build mobile or desktop apps, or even add custom UI\ + \ add-ons into Bitbucket itself using the Connect framework." + version: "2.0" + title: "Bitbucket API" + termsOfService: "https://www.atlassian.com/legal/customer-agreement" + contact: + name: "Bitbucket Support" + url: "https://support.atlassian.com/bitbucket-cloud/" + email: "support@bitbucket.org" +host: "api.bitbucket.org" +basePath: "/2.0" +tags: +- name: "users" + description: "" +- name: "teams" + description: "" +- name: "repositories" + description: "" +- name: "source" + description: "Browse the source code in the repository and\n \ + \ create new commits by uploading." +- name: "refs" + description: "" +- name: "commits" + description: "" +- name: "pullrequests" + description: "" +- name: "issue_tracker" + description: "The issue resources provide functionality for getting information\ + \ on\nissues in an issue tracker, creating new issues, updating them and deleting\n\ + them.\n\nYou can access public issues without authentication, but you can't gain\ + \ access\nto private repositories' issues. By authenticating, you will get the\ + \ ability\nto create issues, as well as access to updating data or deleting issues\ + \ you\nhave access to." +- name: "wiki" + description: "" +- name: "downloads" + description: "" +- name: "snippets" + description: "" +- name: "webhooks" + description: "Webhooks provide a way to configure Bitbucket Cloud to make requests\ + \ to\nyour server (or another external service) whenever certain events occur\ + \ in\nBitbucket Cloud.\n\nA webhook consists of:\n\n* A subject -- The resource\ + \ that generates the events. Currently, this resource\n is the repository, user\ + \ account, or team where you create the webhook.\n* One or more event -- The default\ + \ event is a repository push, but you can\n select multiple events that can trigger\ + \ the webhook.\n* A URL -- The endpoint where you want Bitbucket to send the event\ + \ payloads\n when a matching event happens.\n\nThere are two parts to getting\ + \ a webhook to work: creating the webhook and\ntriggering the webhook. After you\ + \ create a webhook for an event, every time\nthat event occurs, Bitbucket sends\ + \ a payload request that describes the event\nto the specified URL. Thus, you\ + \ can think of webhooks as a kind of\nnotification system.\n\nUse webhooks to\ + \ integrate applications with Bitbucket Cloud. The following\nuse cases provides\ + \ examples of when you would want to use webhooks:\n\n* Every time a user pushes\ + \ commits in a repository, you may want to notify\n your CI server to start a\ + \ build.\n* Every time a user pushes commits or creates a pull request, you may\ + \ want to\n display a notification in your application.\n" +- name: "commitstatuses" + description: "Commit statuses provide a way to tag commits with meta data,\nlike\ + \ automated build results.\n" +- name: "branchrestrictions" + description: "Repository owners and administrators can set branch management\nrules\ + \ on a repository that control what can be pushed by whom.\nThrough these rules,\ + \ you can enforce a project or team\nworkflow. For example, owners or administrators\ + \ can:\n\n* Limit push powers\n* Prevent branch (bookmark) deletion\n* Prevent\ + \ history re-writes (Git only)\n" +- name: "projects" + description: "Bitbucket Cloud projects make it easier for teams to focus on\na goal,\ + \ product, or process by organizing their repositories.\n" +- name: "pipelines" + description: "Bitbucket Pipelines brings continuous delivery to Bitbucket\nCloud,\ + \ empowering teams with full branching to deployment\nvisibility and faster feedback\ + \ loops.\n" +schemes: +- "https" +consumes: +- "application/json" +produces: +- "application/json" +paths: + /repositories/{username}/{repo_slug}/refs/branches/{name}: + get: + tags: + - "refs" + description: "" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "name" + in: "path" + required: true + type: "string" + x-exportParamName: "Name" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /teams/{username}/following: + get: + tags: + - "teams" + description: "Returns the list of accounts this team is following." + parameters: + - name: "username" + in: "path" + description: "The team's username" + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "A paginated list of user objects." + schema: + $ref: "#/definitions/paginated_users" + 404: + description: "If no team exists for the specified name, or if the specified\ + \ account is a personal account, not a team account." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "account" + - basic: [] + - api_key: [] + /user/permissions/repositories: + get: + tags: + - "repositories" + description: "Returns an object for each repository the caller has explicit\ + \ access\nto and their effective permission — the highest level of permission\ + \ the\ncaller has. This does not return public repositories that the user\ + \ was\nnot granted any specific permission in, and does not distinguish between\n\ + direct and indirect privileges.\n\nPermissions can be:\n\n* `admin`\n* `write`\n\ + * `read`\n\nExample:\n\n```\n$ curl https://api.bitbucket.org/2.0/user/permissions/repositories\n\ + \n{\n \"pagelen\": 10,\n \"values\": [\n {\n \"type\": \"repository_permission\"\ + ,\n \"user\": {\n \"type\": \"user\",\n \"username\": \"\ + evzijst\",\n \"display_name\": \"Erik van Zijst\",\n \"uuid\"\ + : \"{d301aafa-d676-4ee0-88be-962be7417567}\"\n },\n \"repository\"\ + : {\n \"type\": \"repository\",\n \"name\": \"geordi\",\n \ + \ \"full_name\": \"bitbucket/geordi\",\n \"uuid\": \"{85d08b4e-571d-44e9-a507-fa476535aa98}\"\ + \n },\n \"permission\": \"admin\"\n }\n ],\n \"page\": 1,\n\ + \ \"size\": 1\n}\n```\n\nResults may be further [filtered or sorted](../../../meta/filtering)\ + \ by\nrepository or permission by adding the following query string\nparameters:\n\ + \n* `q=repository.name=\"geordi\"` or `q=permission>\"read\"`\n* `sort=repository.name`\n\ + \nNote that the query parameter values need to be URL escaped so that `=`\n\ + would become `%3D`." + parameters: + - name: "q" + in: "query" + description: "\nQuery string to narrow down the response as per\n[filtering\ + \ and sorting](../../../meta/filtering)." + required: false + type: "string" + x-exportParamName: "Q" + - name: "sort" + in: "query" + description: "\nName of a response property sort the result by as per\n[filtering\ + \ and sorting](../../../meta/filtering#query-sort).\n" + required: false + type: "string" + x-exportParamName: "Sort" + responses: + 200: + description: "Repository permissions for the repositories a caller has explicit\ + \ access to." + schema: + $ref: "#/definitions/paginated_repository_permissions" + security: + - oauth2: + - "account" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/commit/{sha}/comments/{comment_id}: + get: + tags: + - "commits" + description: "Returns the specified commit comment." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "sha" + in: "path" + required: true + type: "string" + x-exportParamName: "Sha" + - name: "comment_id" + in: "path" + required: true + type: "string" + x-exportParamName: "CommentId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /teams/{username}/pipelines_config/variables/{variable_uuid}: + get: + tags: + - "pipelines" + description: "Retrieve a team level variable." + operationId: "getPipelineVariableForTeam" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "variable_uuid" + in: "path" + description: "The UUID of the variable to retrieve." + required: true + type: "string" + x-exportParamName: "VariableUuid" + responses: + 200: + description: "The variable." + schema: + $ref: "#/definitions/pipeline_variable" + 404: + description: "The account or variable with the given UUID was not found." + schema: + $ref: "#/definitions/error" + put: + tags: + - "pipelines" + description: "Update a team level variable." + operationId: "updatePipelineVariableForTeam" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "variable_uuid" + in: "path" + description: "The UUID of the variable." + required: true + type: "string" + x-exportParamName: "VariableUuid" + - in: "body" + name: "_body" + description: "The updated variable." + required: true + schema: + $ref: "#/definitions/pipeline_variable" + x-exportParamName: "Body" + responses: + 200: + description: "The variable was updated." + schema: + $ref: "#/definitions/pipeline_variable" + 404: + description: "The account or the variable was not found." + schema: + $ref: "#/definitions/error" + delete: + tags: + - "pipelines" + description: "Delete a team level variable." + operationId: "deletePipelineVariableForTeam" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "variable_uuid" + in: "path" + description: "The UUID of the variable to delete." + required: true + type: "string" + x-exportParamName: "VariableUuid" + responses: + 204: + description: "The variable was deleted" + 404: + description: "The account or the variable with the provided UUID does not\ + \ exist." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/hooks: + get: + tags: + - "repositories" + - "webhooks" + description: "Returns a paginated list of webhooks installed on this repository." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The paginated list of installed webhooks." + schema: + $ref: "#/definitions/paginated_webhook_subscriptions" + 403: + description: "If the authenticated user does not have permission to access\ + \ the webhooks." + schema: + $ref: "#/definitions/error" + 404: + description: "If the repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + post: + tags: + - "repositories" + - "webhooks" + description: "Creates a new webhook on the specified repository.\n\nExample:\n\ + \n```\n$ curl -X POST -u credentials -H 'Content-Type: application/json' \ + \ https://api.bitbucket.org/2.0/repositories/username/slug/hooks\ + \ -d '\n {\n \"description\": \"Webhook Description\",\n\ + \ \"url\": \"https://example.com/\",\n \"active\": true,\n \ + \ \"events\": [\n \"repo:push\",\n \"issue:created\",\n \ + \ \"issue:updated\"\n ]\n }'\n```\n\nNote that this call requires\ + \ the webhook scope, as well as any scope\nthat applies to the events that\ + \ the webhook subscribes to. In the\nexample above that means: `webhook`,\ + \ `repository` and `issue`.\n\nAlso note that the `url` must properly resolve\ + \ and cannot be an\ninternal, non-routed address." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 201: + description: "If the webhook was registered successfully." + schema: + $ref: "#/definitions/webhook_subscription" + headers: + Location: + type: "string" + description: "The URL of new newly created webhook." + 403: + description: "If the authenticated user does not have permission to install\ + \ webhooks on the specified repository." + schema: + $ref: "#/definitions/error" + 404: + description: "If the repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/statuses: + get: + tags: + - "repositories" + - "pullrequests" + - "commitstatuses" + description: "Returns all statuses (e.g. build results) for the given pull\n\ + request." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pull_request_id" + in: "path" + description: "The pull request's id" + required: true + type: "integer" + x-exportParamName: "PullRequestId" + responses: + 200: + description: "A paginated list of all commit statuses for this pull request." + schema: + $ref: "#/definitions/paginated_commitstatuses" + 401: + description: "If the repository is private and the request was not authenticated." + 404: + description: "If the specified repository or pull request does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest" + - basic: [] + - api_key: [] + /teams/{username}/projects/: + get: + tags: + - "projects" + description: "" + parameters: + - name: "username" + in: "path" + description: "The team which owns the project. This can either be the `username`\ + \ of\nthe team or the `UUID` of the team (surrounded by curly-braces (`{}`)).\n" + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "A paginated list of projects that belong to the specified\ + \ team." + schema: + $ref: "#/definitions/paginated_projects" + 403: + description: "The requesting user isn't authorized to read the list of projects\ + \ for the specified team." + schema: + $ref: "#/definitions/error" + 404: + description: "A team doesn't exist at this location." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "project" + - basic: [] + - api_key: [] + post: + tags: + - "projects" + description: "Creates a new project.\n\nNote that the avatar has to be embedded\ + \ as either a data-url\nor a URL to an external image as shown in the examples\ + \ below:\n\n```\n$ body=$(cat << EOF\n{\n \"name\": \"Mars Project\",\n\ + \ \"key\": \"MARS\",\n \"description\": \"Software for colonizing mars.\"\ + ,\n \"links\": {\n \"avatar\": {\n \"href\": \"data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/...\"\ + \n }\n },\n \"is_private\": false\n}\nEOF\n)\n$ curl -H \"Content-Type:\ + \ application/json\" \\\n -X POST \\\n -d \"$body\" \\\n \ + \ https://api.bitbucket.org/2.0/teams/teams-in-space/projects/ | jq .\n{\n\ + \ // Serialized project document\n}\n```\n\nor even:\n\n```\n$ body=$(cat\ + \ << EOF\n{\n \"name\": \"Mars Project\",\n \"key\": \"MARS\",\n \ + \ \"description\": \"Software for colonizing mars.\",\n \"links\": {\n\ + \ \"avatar\": {\n \"href\": \"http://i.imgur.com/72tRx4w.gif\"\ + \n }\n },\n \"is_private\": false\n}\nEOF\n)\n$ curl -H \"Content-Type:\ + \ application/json\" \\\n -X POST \\\n -d \"$body\" \\\n \ + \ https://api.bitbucket.org/2.0/teams/teams-in-space/projects/ | jq .\n{\n\ + \ // Serialized project document\n}\n```" + parameters: + - name: "username" + in: "path" + description: "The team which owns the project. This can either be the `username`\ + \ of\nthe team or the `UUID` of the team (surrounded by curly-braces (`{}`)).\n" + required: true + type: "string" + x-exportParamName: "Username" + - in: "body" + name: "_body" + required: true + schema: + $ref: "#/definitions/project" + x-exportParamName: "Body" + responses: + 201: + description: "A new project has been created." + schema: + $ref: "#/definitions/project" + headers: + Location: + type: "string" + description: "The location of the newly created project" + 403: + description: "The requesting user isn't authorized to create the project." + schema: + $ref: "#/definitions/error" + 404: + description: "A team doesn't exist at this location." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "project:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/issues/{issue_id}/attachments/{path}: + get: + tags: + - "issue_tracker" + description: "Returns the contents of the specified file attachment.\n\nNote\ + \ that this endpoint does not return a JSON response, but instead\nreturns\ + \ a redirect pointing to the actual file that in turn will return\nthe raw\ + \ contents.\n\nThe redirect URL contains a one-time token that has a limited\ + \ lifetime.\nAs a result, the link should not be persisted, stored, or shared." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "path" + in: "path" + required: true + type: "string" + x-exportParamName: "Path" + - name: "issue_id" + in: "path" + required: true + type: "string" + x-exportParamName: "IssueId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 302: + description: "A redirect to the file's contents" + headers: + Location: + type: "string" + 401: + description: "If the issue tracker is private and the request was not authenticated." + 404: + description: "If the specified repository or issue does not exist, or if\ + \ the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + delete: + tags: + - "issue_tracker" + description: "Deletes an attachment." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "path" + in: "path" + required: true + type: "string" + x-exportParamName: "Path" + - name: "issue_id" + in: "path" + required: true + type: "string" + x-exportParamName: "IssueId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 204: + description: "Indicates that the deletion was successful" + 401: + description: "If the issue tracker is private and the request was not authenticated." + 404: + description: "If the specified repository, issue, or attachment does not\ + \ exist, or if the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/versions/{version_id}: + get: + tags: + - "issue_tracker" + description: "Returns the specified issue tracker version object." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "version_id" + in: "path" + description: "The version's id" + required: true + type: "integer" + x-exportParamName: "VersionId" + responses: + 200: + description: "The specified version object." + schema: + $ref: "#/definitions/version" + 404: + description: "If the specified repository or version does not exist, or\ + \ if the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/issues/{issue_id}/vote: + get: + tags: + - "issue_tracker" + description: "Check whether the authenticated user has voted for this issue.\n\ + A 204 status code indicates that the user has voted, while a 404\nimplies\ + \ they haven't." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue's id" + required: true + type: "integer" + x-exportParamName: "IssueId" + responses: + 204: + description: "If the authenticated user has not voted for this issue." + schema: + $ref: "#/definitions/error" + 401: + description: "When the request wasn't authenticated." + schema: + $ref: "#/definitions/error" + 404: + description: "If the authenticated user has not voted for this issue, or\ + \ when the repo does not exist, or does not have an issue tracker." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - "account" + - basic: [] + - api_key: [] + put: + tags: + - "issue_tracker" + description: "Vote for this issue.\n\nTo cast your vote, do an empty PUT. The\ + \ 204 status code indicates that\nthe operation was successful." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue's id" + required: true + type: "integer" + x-exportParamName: "IssueId" + responses: + 204: + description: "Indicating the authenticated user has cast their vote successfully." + schema: + $ref: "#/definitions/error" + 401: + description: "When the request wasn't authenticated." + schema: + $ref: "#/definitions/error" + 404: + description: "When the issue does not exist, the repo does not exist, or\ + \ when the repos does not have an issue tracker." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - "account:write" + - basic: [] + - api_key: [] + delete: + tags: + - "issue_tracker" + description: "Retract your vote." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue's id" + required: true + type: "integer" + x-exportParamName: "IssueId" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue:write" + - "account:write" + - basic: [] + - api_key: [] + /users/{username}/pipelines_config/variables/{variable_uuid}: + get: + tags: + - "pipelines" + description: "Retrieve a user level variable." + operationId: "getPipelineVariableForUser" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "variable_uuid" + in: "path" + description: "The UUID of the variable to retrieve." + required: true + type: "string" + x-exportParamName: "VariableUuid" + responses: + 200: + description: "The variable." + schema: + $ref: "#/definitions/pipeline_variable" + 404: + description: "The account or variable with the given UUID was not found." + schema: + $ref: "#/definitions/error" + put: + tags: + - "pipelines" + description: "Update a user level variable." + operationId: "updatePipelineVariableForUser" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "variable_uuid" + in: "path" + description: "The UUID of the variable." + required: true + type: "string" + x-exportParamName: "VariableUuid" + - in: "body" + name: "_body" + description: "The updated variable." + required: true + schema: + $ref: "#/definitions/pipeline_variable" + x-exportParamName: "Body" + responses: + 200: + description: "The variable was updated." + schema: + $ref: "#/definitions/pipeline_variable" + 404: + description: "The account or the variable was not found." + schema: + $ref: "#/definitions/error" + delete: + tags: + - "pipelines" + description: "Delete an account level variable." + operationId: "deletePipelineVariableForUser" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "variable_uuid" + in: "path" + description: "The UUID of the variable to delete." + required: true + type: "string" + x-exportParamName: "VariableUuid" + responses: + 204: + description: "The variable was deleted" + 404: + description: "The account or the variable with the provided UUID does not\ + \ exist." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/milestones: + get: + tags: + - "issue_tracker" + description: "Returns the milestones that have been defined in the issue tracker.\n\ + \nThis resource is only available on repositories that have the issue\ntracker\ + \ enabled." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The milestones that have been defined in the issue tracker." + schema: + $ref: "#/definitions/paginated_milestones" + 404: + description: "If the specified repository does not exist, or if the repository\ + \ doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines/: + get: + tags: + - "pipelines" + description: "Find pipelines" + operationId: "getPipelinesForRepository" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The matching pipelines." + schema: + $ref: "#/definitions/paginated_pipelines" + post: + tags: + - "pipelines" + description: "Endpoint to create and initiate a pipeline. \nThere are a couple\ + \ of different options to initiate a pipeline, where the payload of the request\ + \ will determine which type of pipeline will be instantiated.\n# Trigger a\ + \ Pipeline for a branch or tag\nOne way to trigger pipelines is by specifying\ + \ the reference for which you want to trigger a pipeline (e.g. a branch or\ + \ tag). \nThe specified reference will be used to determine which pipeline\ + \ definition from the `bitbucket-pipelines.yml` file will be applied to initiate\ + \ the pipeline. The pipeline will then do a clone of the repository and checkout\ + \ the latest revision of the specified reference.\n\n### Example\n\n```\n\ + $ curl -X POST -is -u username:password \\\n -H 'Content-Type: application/json'\ + \ \\\n https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/\ + \ \\\n -d '\n {\n \"target\": {\n \"ref_type\": \"branch\", \n \ + \ \"type\": \"pipeline_ref_target\", \n \"ref_name\": \"master\"\n\ + \ }\n }'\n```\n# Trigger a Pipeline for a commit on a branch or tag\n\ + You can initiate a pipeline for a specific commit and in the context of a\ + \ specified reference (e.g. a branch, tag or bookmark).\nThe specified reference\ + \ will be used to determine which pipeline definition from the bitbucket-pipelines.yml\ + \ file will be applied to initiate the pipeline. The pipeline will clone the\ + \ repository and then do a checkout the specified reference. \n\nThe following\ + \ reference types are supported:\n\n* `branch` \n* `named_branch`\n* `bookmark`\ + \ \n * `tag`\n\n### Example\n\n```\n$ curl -X POST -is -u username:password\ + \ \\\n -H 'Content-Type: application/json' \\\n https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/\ + \ \\\n -d '\n {\n \"target\": {\n \"commit\": {\n \"type\"\ + : \"commit\", \n \"hash\": \"ce5b7431602f7cbba007062eeb55225c6e18e956\"\ + \n }, \n \"ref_type\": \"branch\", \n \"type\": \"pipeline_ref_target\"\ + , \n \"ref_name\": \"master\"\n }\n }'\n```\n# Trigger a specific\ + \ pipeline definition for a commit\nYou can trigger a specific pipeline that\ + \ is defined in your `bitbucket-pipelines.yml` file for a specific commit.\ + \ \nIn addition to the commit revision, you specify the type and pattern of\ + \ the selector that identifies the pipeline definition. The resulting pipeline\ + \ will then clone the repository and checkout the specified revision.\n\n\ + ### Example\n\n```\n$ curl -X POST -is -u username:password \\\n -H 'Content-Type:\ + \ application/json' \\\n https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/\ + \ \\\n -d '\n {\n \"target\": {\n \"commit\": {\n \"hash\"\ + :\"a3c4e02c9a3755eccdc3764e6ea13facdf30f923\",\n \"type\":\"commit\"\ + \n },\n \"selector\": {\n \"type\":\"custom\",\n \ + \ \"pattern\":\"Deploy to production\"\n },\n \"\ + type\":\"pipeline_commit_target\"\n }\n }'\n```\n# Trigger a specific pipeline\ + \ definition for a commit on a branch or tag\nYou can trigger a specific pipeline\ + \ that is defined in your `bitbucket-pipelines.yml` file for a specific commit\ + \ in the context of a specified reference. \nIn addition to the commit revision,\ + \ you specify the type and pattern of the selector that identifies the pipeline\ + \ definition, as well as the reference information. The resulting pipeline\ + \ will then clone the repository a checkout the specified reference.\n\n###\ + \ Example\n\n```\n$ curl -X POST -is -u username:password \\\n -H 'Content-Type:\ + \ application/json' \\\n https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/\ + \ \\\n -d '\n {\n \"target\": {\n \"commit\": {\n \"hash\"\ + :\"a3c4e02c9a3755eccdc3764e6ea13facdf30f923\",\n \"type\":\"commit\"\ + \n },\n \"selector\": {\n \"type\": \"custom\",\n \ + \ \"pattern\": \"Deploy to production\"\n },\n \"type\"\ + : \"pipeline_ref_target\",\n \"ref_name\": \"master\",\n \"ref_type\"\ + : \"branch\"\n }\n }'\n```\n" + operationId: "createPipelineForRepository" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The pipeline to initiate." + required: true + schema: + $ref: "#/definitions/pipeline" + x-exportParamName: "Body" + responses: + 201: + description: "The initiated pipeline." + schema: + $ref: "#/definitions/pipeline" + headers: + Location: + type: "string" + description: "The URL of the newly created pipeline." + 400: + description: "The account or repository is not enabled, the yml file does\ + \ not exist in the repository for the given revision, or the request body\ + \ contained invalid properties." + schema: + $ref: "#/definitions/error" + 404: + description: "The account or repository was not found." + schema: + $ref: "#/definitions/error" + /addon/linkers/{linker_key}/values: + get: + tags: + - "addon" + description: "" + parameters: + - name: "linker_key" + in: "path" + required: true + type: "string" + x-exportParamName: "LinkerKey" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + post: + tags: + - "addon" + description: "" + parameters: + - name: "linker_key" + in: "path" + required: true + type: "string" + x-exportParamName: "LinkerKey" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + put: + tags: + - "addon" + description: "" + parameters: + - name: "linker_key" + in: "path" + required: true + type: "string" + x-exportParamName: "LinkerKey" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + delete: + tags: + - "addon" + description: "" + parameters: + - name: "linker_key" + in: "path" + required: true + type: "string" + x-exportParamName: "LinkerKey" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/issues/{issue_id}/changes: + get: + tags: + - "issue_tracker" + description: "Returns the list of all changes that have been made to the specified\n\ + issue. Changes are returned in chronological order with the oldest\nchange\ + \ first.\n\nEach time an issue is edited in the UI or through the API, an\ + \ immutable\nchange record is created. It also has a comment associated to\ + \ it.\n\n```\n$ curl -s https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1/changes\ + \ - | jq .\n\n{\n \"pagelen\": 20,\n \"values\": [\n {\n \"changes\"\ + : {\n \"priority\": {\n \"new\": \"trivial\",\n \"\ + old\": \"major\"\n },\n \"assignee\": {\n \"new\":\ + \ \"\",\n \"old\": \"evzijst\"\n },\n \"kind\": {\n\ + \ \"new\": \"enhancement\",\n \"old\": \"bug\"\n \ + \ }\n },\n \"links\": {\n \"self\": {\n \"href\"\ + : \"https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1/changes/2\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/evzijst/dogslow/issues/1#comment-2\"\ + \n }\n },\n \"issue\": {\n \"links\": {\n \ + \ \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1\"\ + \n }\n },\n \"type\": \"issue\",\n \"id\": 1,\n\ + \ \"repository\": {\n \"links\": {\n \"self\":\ + \ {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/evzijst/dogslow\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/evzijst/dogslow\"\ + \n },\n \"avatar\": {\n \"href\": \"https://bitbucket.org/evzijst/dogslow/avatar/32/\"\ + \n }\n },\n \"type\": \"repository\",\n \ + \ \"name\": \"dogslow\",\n \"full_name\": \"evzijst/dogslow\"\ + ,\n \"uuid\": \"{988b17c6-1a47-4e70-84ee-854d5f012bf6}\"\n \ + \ },\n \"title\": \"Updated title\"\n },\n \"created_on\"\ + : \"2018-03-03T00:35:28.353630+00:00\",\n \"user\": {\n \"username\"\ + : \"evzijst\",\n \"display_name\": \"evzijst\",\n \"type\":\ + \ \"user\",\n \"uuid\": \"{aaa7972b-38af-4fb1-802d-6e3854c95778}\"\ + ,\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/evzijst/\"\ + \n },\n \"avatar\": {\n \"href\": \"https://bitbucket.org/account/evzijst/avatar/32/\"\ + \n }\n }\n },\n \"message\": {\n \"raw\"\ + : \"Removed assignee, changed kind and priority.\",\n \"markup\": \"\ + markdown\",\n \"html\": \"

Removed assignee, changed kind and priority.

\"\ + ,\n \"type\": \"rendered\"\n },\n \"type\": \"issue_change\"\ + ,\n \"id\": 2\n }\n ],\n \"page\": 1\n}\n```\n\nChanges support\ + \ [filtering and sorting](../../../meta/filtering) that\ncan be used to search\ + \ for specific changes. For instance, to see\nwhen an issue transitioned to\ + \ \"resolved\":\n\n```\n$ curl -s https://api.bitbucket.org/2.0/repositories/site/master/issues/1/changes\ + \ \\\n -G --data-urlencode='q=changes.state.new = \"resolved\"'\n```\n\n\ + This resource is only available on repositories that have the issue\ntracker\ + \ enabled." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue id" + required: true + type: "string" + x-exportParamName: "IssueId" + - name: "q" + in: "query" + description: "\nQuery string to narrow down the response as per\n[filtering\ + \ and sorting](../../../meta/filtering)." + required: false + type: "string" + x-exportParamName: "Q" + - name: "sort" + in: "query" + description: "\nName of a response property to sort the result by as per\n\ + [filtering and sorting](../../../meta/filtering#query-sort).\n" + required: false + type: "string" + x-exportParamName: "Sort" + responses: + 200: + description: "Returns all the issue changes that were made on the specified\ + \ issue." + schema: + $ref: "#/definitions/paginated_log_entries" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + post: + tags: + - "issue_tracker" + description: "Makes a change to the specified issue.\n\nFor example, to change\ + \ an issue's state and assignee, create a new\nchange object that modifies\ + \ these fields:\n\n```\ncurl https://api.bitbucket.org/2.0/site/master/issues/1234/changes\ + \ \\\n -s -u evzijst -X POST -H \"Content-Type: application/json\" \\\n \ + \ -d '{\n \"changes\": {\n \"assignee\": {\n \"new\": \"evzijst\"\ + \n },\n \"state\": {\n \"new\": 'resolved\"\n }\n \ + \ }\n \"message\": {\n \"raw\": \"This is now resolved.\"\n }\n\ + \ }'\n```\n\nThe above example also includes a custom comment to go alongside\ + \ the\nchange. This comment will also be visible on the issue page in the\ + \ UI.\n\nNote that the fields of the `changes` object are strings, not objects.\n\ + This allows for immutable change log records, even after user accounts,\n\ + milestones, or other objects recorded in a change entry, get renamed or\n\ + deleted.\n\nThe assignee field stores the username. When POSTing a new change\ + \ and\nchanging the assignee, the client should also use the username in the\n\ + `changes.assignee.new` field.\n\nThis call requires authentication. Private\ + \ repositories or private\nissue trackers require the caller to authenticate\ + \ with an account that\nhas appropriate authorization." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "issue_id" + in: "path" + required: true + type: "string" + x-exportParamName: "IssueId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The new issue state change. Note that the only required elements\ + \ are `changes.[].new`. All other elements can be omitted from the body." + required: true + schema: + $ref: "#/definitions/issue_change" + x-exportParamName: "Body" + responses: + 201: + description: "The newly created issue change." + schema: + $ref: "#/definitions/issue_change" + headers: + Location: + type: "string" + description: "The (absolute) URL of the newly created issue change." + 401: + description: "When the request wasn't authenticated." + schema: + $ref: "#/definitions/error" + 403: + description: "When the authenticated user lacks the privilege to modify\ + \ the specified issue." + schema: + $ref: "#/definitions/error" + 404: + description: "If the specified repository or issue does not exist, or if\ + \ the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/refs/branches: + get: + tags: + - "refs" + description: "" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /hook_events/{subject_type}: + get: + tags: + - "webhooks" + description: "Returns a paginated list of all valid webhook events for the\n\ + specified entity.\n\nThis is public data that does not require any scopes\ + \ or authentication.\n\nExample:\n\nNOTE: The following example is a truncated\ + \ response object for the `team` `subject_type`.\nWe return the same structure\ + \ for the other `subject_type` objects.\n\n```\n$ curl https://api.bitbucket.org/2.0/hook_events/team\n\ + {\n \"page\": 1,\n \"pagelen\": 30,\n \"size\": 21,\n \"values\"\ + : [\n {\n \"category\": \"Repository\",\n \"\ + description\": \"Whenever a repository push occurs\",\n \"event\"\ + : \"repo:push\",\n \"label\": \"Push\"\n },\n {\n\ + \ \"category\": \"Repository\",\n \"description\": \"\ + Whenever a repository fork occurs\",\n \"event\": \"repo:fork\"\ + ,\n \"label\": \"Fork\"\n },\n ...\n {\n \ + \ \"category\": \"Repository\",\n \"description\": \"\ + Whenever a repository import occurs\",\n \"event\": \"repo:imported\"\ + ,\n \"label\": \"Import\"\n }\n ]\n}\n```" + parameters: + - name: "subject_type" + in: "path" + description: "A resource or subject type." + required: true + type: "string" + enum: + - "user" + - "repository" + - "team" + x-exportParamName: "SubjectType" + responses: + 200: + description: "A paginated list of webhook types available to subscribe on." + schema: + $ref: "#/definitions/paginated_hook_events" + 404: + description: "If an invalid `{subject_type}` value was specified." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /users/{username}/followers: + get: + tags: + - "users" + description: "Returns the list of accounts that are following this team." + parameters: + - name: "username" + in: "path" + description: "The account's username" + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "A paginated list of user objects." + schema: + $ref: "#/definitions/paginated_users" + 404: + description: "If no account exists for the specified name, or if the specified\ + \ account is a team account, not a personal account." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/default-reviewers: + get: + tags: + - "pullrequests" + description: "Returns the repository's default reviewers.\n\nThese are the users\ + \ that are automatically added as reviewers on every\nnew pull request that\ + \ is created." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The paginated list of default reviewers" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + /teams/{username}/search/code: + get: + parameters: [] + responses: + 200: + schema: + $ref: "#/definitions/search_result" + /teams/{username}/pipelines_config/variables/: + get: + tags: + - "pipelines" + description: "Find account level variables." + operationId: "getPipelineVariablesForTeam" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "The found account level variables." + schema: + $ref: "#/definitions/paginated_pipeline_variables" + post: + tags: + - "pipelines" + description: "Create an account level variable." + operationId: "createPipelineVariableForTeam" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - in: "body" + name: "_body" + description: "The variable to create." + required: false + schema: + $ref: "#/definitions/pipeline_variable" + x-exportParamName: "Body" + responses: + 201: + description: "The created variable." + schema: + $ref: "#/definitions/pipeline_variable" + headers: + Location: + type: "string" + description: "The URL of the newly created pipeline variable." + 404: + description: "The account does not exist." + schema: + $ref: "#/definitions/error" + 409: + description: "A variable with the provided key already exists." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/downloads/{filename}: + get: + tags: + - "downloads" + description: "Return a redirect to the contents of a download artifact.\n\n\ + This endpoint returns the actual file contents and not the artifact's\nmetadata.\n\ + \n $ curl -s -L https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads/hello.txt\n\ + \ Hello World" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "filename" + in: "path" + required: true + type: "string" + x-exportParamName: "Filename" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + delete: + tags: + - "downloads" + description: "Deletes the specified download artifact from the repository." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "filename" + in: "path" + required: true + type: "string" + x-exportParamName: "Filename" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key}: + get: + tags: + - "repositories" + - "commitstatuses" + description: "Returns the specified build status for a commit." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "node" + in: "path" + description: "The commit's SHA1" + required: true + type: "string" + x-exportParamName: "Node" + - name: "key" + in: "path" + description: "The build status' unique key" + required: true + type: "string" + x-exportParamName: "Key" + responses: + 200: + description: "The build status object with the specified key." + schema: + $ref: "#/definitions/commitstatus" + 401: + description: "If the repository is private and the request was not authenticated." + 404: + description: "If the repository, commit, or build status key does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + put: + tags: + - "repositories" + - "commitstatuses" + description: "Used to update the current status of a build status object on\ + \ the\nspecific commit.\n\nThis operation can also be used to change other\ + \ properties of the\nbuild status:\n\n* `state`\n* `name`\n* `description`\n\ + * `url`\n* `refname`\n\nThe `key` cannot be changed." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "node" + in: "path" + description: "The commit's SHA1" + required: true + type: "string" + x-exportParamName: "Node" + - name: "key" + in: "path" + description: "The commit status' unique key" + required: true + type: "string" + x-exportParamName: "Key" + - in: "body" + name: "_body" + description: "The updated build status object" + required: false + schema: + $ref: "#/definitions/commitstatus" + x-exportParamName: "Body" + responses: + 200: + description: "The updated build status object." + schema: + $ref: "#/definitions/commitstatus" + 401: + description: "If the repository is private and the request was not authenticated." + 404: + description: "If the repository or build does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/watchers: + get: + tags: + - "repositories" + description: "Returns a paginated list of all the watchers on the specified\n\ + repository." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/components: + get: + tags: + - "issue_tracker" + description: "Returns the components that have been defined in the issue tracker.\n\ + \nThis resource is only available on repositories that have the issue\ntracker\ + \ enabled." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The components that have been defined in the issue tracker." + schema: + $ref: "#/definitions/paginated_components" + 404: + description: "If the specified repository does not exist, or if the repository\ + \ doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/properties/{app_key}/{property_name}: + get: + parameters: [] + put: + parameters: [] + delete: + parameters: [] + /snippets/{username}/{encoded_id}/commits: + get: + tags: + - "snippets" + description: "Returns the changes (commits) made on this snippet." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 200: + description: "The paginated list of snippet commits." + schema: + $ref: "#/definitions/paginated_snippet_commit" + 403: + description: "If the authenticated user does not have access to the snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + /users/{username}/repositories: + get: + tags: + - "users" + - "teams" + description: "All repositories owned by a user/team. This includes private\n\ + repositories, but filtered down to the ones that the calling user has\naccess\ + \ to." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pullrequests/activity: + get: + tags: + - "pullrequests" + description: "Returns a paginated list of the pull request's activity log.\n\ + \nThis includes comments that were made by the reviewers, updates and\napprovals." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pull_request_id" + in: "path" + description: "The id of the pull request.\n" + required: true + type: "integer" + x-exportParamName: "PullRequestId" + responses: + 200: + description: "The pull request activity log" + 401: + description: "If the repository is private and the request was not authenticated." + 404: + description: "If the specified repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest" + - basic: [] + - api_key: [] + /snippets/{username}/{encoded_id}/comments/{comment_id}: + get: + tags: + - "snippets" + description: "Returns the specific snippet comment." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "comment_id" + in: "path" + required: true + type: "string" + x-exportParamName: "CommentId" + - name: "encoded_id" + in: "path" + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 200: + description: "The specified comment." + schema: + $ref: "#/definitions/snippet_comment" + 403: + description: "If the authenticated user does not have access to the snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the comment or snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + put: + tags: + - "snippets" + description: "Updates a comment.\n\nComments can only be updated by their author." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "comment_id" + in: "path" + required: true + type: "string" + x-exportParamName: "CommentId" + - name: "encoded_id" + in: "path" + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 200: + description: "The updated comment object." + 403: + description: "If the authenticated user does not have access to the snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the comment or snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + delete: + tags: + - "snippets" + description: "Deletes a snippet comment.\n\nComments can only be removed by\ + \ their author." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "comment_id" + in: "path" + required: true + type: "string" + x-exportParamName: "CommentId" + - name: "encoded_id" + in: "path" + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 204: + description: "Indicates the comment was deleted successfully." + 403: + description: "If the authenticated user is not the author of the comment." + schema: + $ref: "#/definitions/error" + 404: + description: "If the comment or the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + /teams/{username}/permissions: + get: + tags: [] + description: "Returns an object for each team permission a user on the team\ + \ has.\n\nPermissions returned are effective permissions — if a user is a\ + \ member of\nmultiple groups with distinct roles, only the highest level is\ + \ returned.\n\nPermissions can be:\n\n* `admin`\n* `collaborator`\n\nOnly\ + \ users with admin permission for the team may access this resource.\n\nExample:\n\ + \n```\n$ curl https://api.bitbucket.org/2.0/teams/atlassian_tutorial/permissions\n\ + \n{\n \"pagelen\": 10,\n \"values\": [\n {\n \"permission\": \"\ + admin\",\n \"type\": \"team_permission\",\n \"user\": {\n \ + \ \"type\": \"user\",\n \"username\": \"evzijst\",\n \"display_name\"\ + : \"Erik van Zijst\",\n \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\"\ + \n },\n \"team\": {\n \"username\": \"bitbucket\",\n \ + \ \"display_name\": \"Atlassian Bitbucket\",\n \"uuid\": \"{4cc6108a-a241-4db0-96a5-64347ac04f87}\"\ + \n }\n },\n {\n \"permission\": \"collaborator\",\n \"\ + type\": \"team_permission\",\n \"user\": {\n \"type\": \"user\"\ + ,\n \"username\": \"seanaty\",\n \"display_name\": \"Sean Conaty\"\ + ,\n \"uuid\": \"{504c3b62-8120-4f0c-a7bc-87800b9d6f70}\"\n },\n\ + \ \"team\": {\n \"username\": \"bitbucket\",\n \"display_name\"\ + : \"Atlassian Bitbucket\",\n \"uuid\": \"{4cc6108a-a241-4db0-96a5-64347ac04f87}\"\ + \n }\n }\n ],\n \"page\": 1,\n \"size\": 2\n}\n```\n\nResults may\ + \ be further [filtered or sorted](../../../meta/filtering) by\nteam, user,\ + \ or permission by adding the following query string\nparameters:\n\n* `q=user.username=\"\ + evzijst\"` or `q=permission=\"admin\"`\n* `sort=team.display_name`\n\nNote\ + \ that the query parameter values need to be URL escaped so that `=`\nwould\ + \ become `%3D`." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the team,\nsurrounded\ + \ by curly-braces, for example: `{team UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "q" + in: "query" + description: "\nQuery string to narrow down the response as per\n[filtering\ + \ and sorting](../../../meta/filtering)." + required: false + type: "string" + x-exportParamName: "Q" + - name: "sort" + in: "query" + description: "\nName of a response property sort the result by as per\n[filtering\ + \ and sorting](../../../meta/filtering#query-sort).\n" + required: false + type: "string" + x-exportParamName: "Sort" + responses: + 200: + description: "Repositories owned by a team." + schema: + $ref: "#/definitions/paginated_team_permissions" + 403: + description: "The requesting user isn't an admin of the team." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "team" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/diff/{spec}: + get: + tags: + - "commits" + description: "Produces a raw, git-style diff for either a single commit (diffed\n\ + against its first parent), or a revspec of 2 commits (e.g.\n`3a8b42..9ff173`\ + \ where the first commit represents the source and the\nsecond commit the\ + \ destination).\n\nIn case of the latter (diffing a revspec), a 3-way diff,\ + \ or merge diff,\nis computed. This shows the changes introduced by the left\ + \ branch\n(`3a8b42` in our example) as compared againt the right branch\n\ + (`9ff173`).\n\nThis is equivalent to merging the left branch into the right\ + \ branch and\nthen computing the diff of the merge commit against its first\ + \ parent\n(the right branch). This follows the same behavior as pull requests\n\ + that also show this style of 3-way, or merge diff.\n\nWhile similar to patches,\ + \ diffs:\n\n* Don't have a commit header (username, commit message, etc)\n\ + * Support the optional `path=foo/bar.py` query param to filter\n the diff\ + \ to just that one file diff\n\nThe raw diff is returned as-is, in whatever\ + \ encoding the files in the\nrepository use. It is not decoded into unicode.\ + \ As such, the\ncontent-type is `text/plain`." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "spec" + in: "path" + required: true + type: "string" + x-exportParamName: "Spec" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "context" + in: "query" + description: "Generate diffs with lines of context instead of the usual\ + \ three" + required: false + type: "integer" + x-exportParamName: "Context" + - name: "path" + in: "query" + description: "Limit the diff to a particular file (this parameter\ncan be\ + \ repeated for multiple paths)" + required: false + type: "string" + x-exportParamName: "Path" + - name: "ignore_whitespace" + in: "query" + description: "Generate diffs that ignore whitespace" + required: false + type: "boolean" + x-exportParamName: "IgnoreWhitespace" + responses: + 200: + description: "The raw diff" + 555: + description: "If the diff was too large and timed out.\n\nSince this endpoint\ + \ does not employ any form of pagination, but\ninstead returns the diff\ + \ as a single document, it can run into\ntrouble on very large diffs.\ + \ If Bitbucket times out in cases\nlike these, a 555 status code is returned." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}: + get: + tags: + - "pipelines" + description: "Retrieve a schedule by its UUID." + operationId: "getRepositoryPipelineSchedule" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "schedule_uuid" + in: "path" + description: "The uuid of the schedule." + required: true + type: "string" + x-exportParamName: "ScheduleUuid" + responses: + 200: + description: "The requested schedule." + schema: + $ref: "#/definitions/pipeline_schedule" + 404: + description: "The account, repository or schedule was not found." + schema: + $ref: "#/definitions/error" + put: + tags: + - "pipelines" + description: "Update a schedule." + operationId: "updateRepositoryPipelineSchedule" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "schedule_uuid" + in: "path" + description: "The uuid of the schedule." + required: true + type: "string" + x-exportParamName: "ScheduleUuid" + - in: "body" + name: "_body" + description: "The schedule to update." + required: true + schema: + $ref: "#/definitions/pipeline_schedule" + x-exportParamName: "Body" + responses: + 200: + description: "The schedule is updated." + schema: + $ref: "#/definitions/pipeline_schedule" + 404: + description: "The account, repository or schedule was not found." + schema: + $ref: "#/definitions/error" + delete: + tags: + - "pipelines" + description: "Delete a schedule." + operationId: "deleteRepositoryPipelineSchedule" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "schedule_uuid" + in: "path" + description: "The uuid of the schedule." + required: true + type: "string" + x-exportParamName: "ScheduleUuid" + responses: + 204: + description: "The schedule was deleted." + 404: + description: "The account, repository or schedule was not found." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/branch-restrictions: + get: + tags: + - "branchrestrictions" + description: "Returns a paginated list of all branch restrictions on the\nrepository." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "A paginated list of branch restrictions" + schema: + $ref: "#/definitions/paginated_branchrestrictions" + 401: + description: "If the request was not authenticated" + schema: + $ref: "#/definitions/error" + 403: + description: "If the authenticated user does not have admin access to the\ + \ repository" + schema: + $ref: "#/definitions/error" + 404: + description: "If the repository does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + post: + tags: + - "branchrestrictions" + description: "Creates a new branch restriction rule for a repository.\n\n`kind`\ + \ describes what will be restricted. Allowed values are: `push`,\n`force`,\ + \ `delete`, and `restrict_merges`.\n\nDifferent kinds of branch restrictions\ + \ have different requirements:\n\n* `push` and `restrict_merges` require `users`\ + \ and `groups` to be\n specified. Empty lists are allowed, in which case\ + \ permission is\n denied for everybody.\n* `force` can not be specified in\ + \ a Mercurial repository.\n\n`pattern` is used to determine which branches\ + \ will be restricted.\n\nA `'*'` in `pattern` will expand to match zero or\ + \ more characters, and\nevery other character matches itself. For example,\ + \ `'foo*'` will match\n`'foo'` and `'foobar'`, but not `'barfoo'`. `'*'` will\ + \ match all\nbranches.\n\n`users` and `groups` are lists of user names and\ + \ group names.\n\n`kind` and `pattern` must be unique within a repository;\ + \ adding new\nusers or groups to an existing restriction should be done via\ + \ `PUT`.\n\nNote that branch restrictions with overlapping patterns are allowed,\n\ + but the resulting behavior may be surprising." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The new rule" + required: true + schema: + $ref: "#/definitions/branchrestriction" + x-exportParamName: "Body" + responses: + 201: + description: "A paginated list of branch restrictions" + schema: + $ref: "#/definitions/branchrestriction" + 401: + description: "If the request was not authenticated" + schema: + $ref: "#/definitions/error" + 403: + description: "If the authenticated user does not have admin access to the\ + \ repository" + schema: + $ref: "#/definitions/error" + 404: + description: "If the repository does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/issues/{issue_id}/comments/{comment_id}: + get: + tags: + - "issue_tracker" + description: "Returns the specified issue comment object." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "comment_id" + in: "path" + required: true + type: "string" + x-exportParamName: "CommentId" + - name: "issue_id" + in: "path" + required: true + type: "string" + x-exportParamName: "IssueId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + /teams/{username}/projects/{project_key}: + get: + tags: + - "projects" + description: "" + parameters: + - name: "username" + in: "path" + description: "The team which owns the project. This can either be the `username`\ + \ of\nthe team or the `UUID` of the team (surrounded by curly-braces (`{}`)).\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "project_key" + in: "path" + description: "The project in question. This can either be the actual `key`\ + \ assigned\nto the project or the `UUID` (surrounded by curly-braces (`{}`)).\n" + required: true + type: "string" + x-exportParamName: "ProjectKey" + responses: + 200: + description: "The project object." + schema: + $ref: "#/definitions/project" + 403: + description: "The requesting user isn't authorized to access the project." + schema: + $ref: "#/definitions/error" + 404: + description: "A project isn't hosted at this location." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "project" + - basic: [] + - api_key: [] + put: + tags: + - "projects" + description: "Since this endpoint can be used to both update and to create a\n\ + project, the request body depends on the intent.\n\n### Creation\n\nSee the\ + \ POST documentation for the project collection for an\nexample of the request\ + \ body.\n\nNote: The `key` should not be specified in the body of request\n\ + (since it is already present in the URL). The `name` is required,\neverything\ + \ else is optional.\n\n### Update\n\nSee the POST documentation for the project\ + \ collection for an\nexample of the request body.\n\nNote: The key is not\ + \ required in the body (since it is already in\nthe URL). The key may be specified\ + \ in the body, if the intent is\nto change the key itself. In such a scenario,\ + \ the location of the\nproject is changed and is returned in the `Location`\ + \ header of the\nresponse." + parameters: + - name: "username" + in: "path" + description: "The team which owns the project. This can either be the `username`\ + \ of\nthe team or the `UUID` of the team (surrounded by curly-braces (`{}`)).\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "project_key" + in: "path" + description: "The project in question. This can either be the actual `key`\ + \ assigned\nto the project or the `UUID` (surrounded by curly-braces (`{}`)).\n" + required: true + type: "string" + x-exportParamName: "ProjectKey" + - in: "body" + name: "_body" + required: true + schema: + $ref: "#/definitions/project" + x-exportParamName: "Body" + responses: + 200: + description: "The existing project is has been updated." + schema: + $ref: "#/definitions/project" + headers: + Location: + type: "string" + description: "The location of the project. This header is only provided\n\ + when the project key is updated." + 201: + description: "A new project has been created." + schema: + $ref: "#/definitions/project" + headers: + Location: + type: "string" + description: "The location of the newly created project" + 403: + description: "The requesting user isn't authorized to update or create the\ + \ project." + schema: + $ref: "#/definitions/error" + 404: + description: "A team doesn't exist at the location. Note that the project's\ + \ absence from this location doesn't raise a 404, since a PUT at a non-existent\ + \ location can be used to create a new project." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "project:write" + - basic: [] + - api_key: [] + delete: + tags: + - "projects" + description: "" + parameters: + - name: "username" + in: "path" + description: "The team which owns the project. This can either be the `username`\ + \ of\nthe team or the `UUID` of the team (surrounded by curly-braces (`{}`)).\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "project_key" + in: "path" + description: "The project in question. This can either be the actual `key`\ + \ assigned\nto the project or the `UUID` (surrounded by curly-braces (`{}`)).\n" + required: true + type: "string" + x-exportParamName: "ProjectKey" + responses: + 204: + description: "Successful deletion." + 403: + description: "The requesting user isn't authorized to delete the project\ + \ or the project isn't empty." + schema: + $ref: "#/definitions/error" + 404: + description: "A project isn't hosted at this location." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "project:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/hooks/{uid}: + get: + tags: + - "repositories" + - "webhooks" + description: "Returns the webhook with the specified id installed on the specified\n\ + repository." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "uid" + in: "path" + description: "The installed webhook's id." + required: true + type: "string" + x-exportParamName: "Uid" + responses: + 200: + description: "The webhook subscription object." + schema: + $ref: "#/definitions/webhook_subscription" + 404: + description: "If the webhook or repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + put: + tags: + - "repositories" + - "webhooks" + description: "Updates the specified webhook subscription.\n\nThe following properties\ + \ can be mutated:\n\n* `description`\n* `url`\n* `active`\n* `events`" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "uid" + in: "path" + description: "The installed webhook's id" + required: true + type: "string" + x-exportParamName: "Uid" + responses: + 200: + description: "The webhook subscription object." + schema: + $ref: "#/definitions/webhook_subscription" + 403: + description: "If the authenticated user does not have permission to update\ + \ the webhook." + schema: + $ref: "#/definitions/error" + 404: + description: "If the webhook or repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + delete: + tags: + - "repositories" + - "webhooks" + description: "Deletes the specified webhook subscription from the given\nrepository." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "uid" + in: "path" + description: "The installed webhook's id" + required: true + type: "string" + x-exportParamName: "Uid" + responses: + 204: + description: "When the webhook was deleted successfully" + 403: + description: "If the authenticated user does not have permission to delete\ + \ the webhook." + schema: + $ref: "#/definitions/error" + 404: + description: "If the webhook or repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines_config/variables/: + get: + tags: + - "pipelines" + description: "Find repository level variables." + operationId: "getRepositoryPipelineVariables" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The retrieved variables." + schema: + $ref: "#/definitions/paginated_pipeline_variables" + post: + tags: + - "pipelines" + description: "Create a repository level variable." + operationId: "createRepositoryPipelineVariable" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The variable to create." + required: true + schema: + $ref: "#/definitions/pipeline_variable" + x-exportParamName: "Body" + responses: + 201: + description: "The variable was created." + schema: + $ref: "#/definitions/pipeline_variable" + headers: + Location: + type: "string" + description: "The URL of the newly created pipeline variable." + 404: + description: "The account or repository does not exist." + schema: + $ref: "#/definitions/error" + 409: + description: "A variable with the provided key already exists." + schema: + $ref: "#/definitions/error" + /users/{username}: + get: + tags: + - "users" + description: "Gets the public information associated with a user account.\n\n\ + If the user's profile is private, `location`, `website` and\n`created_on`\ + \ elements are omitted." + parameters: + - name: "username" + in: "path" + description: "The account's username or UUID." + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "The user object" + schema: + $ref: "#/definitions/user" + 404: + description: "If no user exists for the specified name or UUID, or if the\ + \ specified account is a team account, not a personal account." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /users/{username}/pipelines_config/variables/: + get: + tags: + - "pipelines" + description: "Find user level variables." + operationId: "getPipelineVariablesForUser" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "The found user level variables." + schema: + $ref: "#/definitions/paginated_pipeline_variables" + post: + tags: + - "pipelines" + description: "Create a user level variable." + operationId: "createPipelineVariableForUser" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - in: "body" + name: "_body" + description: "The variable to create." + required: false + schema: + $ref: "#/definitions/pipeline_variable" + x-exportParamName: "Body" + responses: + 201: + description: "The created variable." + schema: + $ref: "#/definitions/pipeline_variable" + headers: + Location: + type: "string" + description: "The URL of the newly created pipeline variable." + 404: + description: "The account does not exist." + schema: + $ref: "#/definitions/error" + 409: + description: "A variable with the provided key already exists." + schema: + $ref: "#/definitions/error" + /snippets/{username}/{encoded_id}: + get: + tags: + - "snippets" + description: "Retrieves a single snippet.\n\nSnippets support multiple content\ + \ types:\n\n* application/json\n* multipart/related\n* multipart/form-data\n\ + \n\napplication/json\n----------------\n\nThe default content type of the\ + \ response is `application/json`.\nSince JSON is always `utf-8`, it cannot\ + \ reliably contain file contents\nfor files that are not text. Therefore,\ + \ JSON snippet documents only\ncontain the filename and links to the file\ + \ contents.\n\nThis means that in order to retrieve all parts of a snippet,\ + \ N+1\nrequests need to be made (where N is the number of files in the\nsnippet).\n\ + \n\nmultipart/related\n-----------------\n\nTo retrieve an entire snippet\ + \ in a single response, use the\n`Accept: multipart/related` HTTP request\ + \ header.\n\n $ curl -H \"Accept: multipart/related\" https://api.bitbucket.org/2.0/snippets/evzijst/1\n\ + \nResponse:\n\n HTTP/1.1 200 OK\n Content-Length: 2214\n Content-Type:\ + \ multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\"\ + \n MIME-Version: 1.0\n\n --===============1438169132528273974==\n \ + \ Content-Type: application/json; charset=\"utf-8\"\n MIME-Version: 1.0\n\ + \ Content-ID: snippet\n\n {\n \"links\": {\n \"self\": {\n\ + \ \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/snippets/evzijst/kypj\"\ + \n },\n \"comments\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/comments\"\ + \n },\n \"watchers\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/watchers\"\ + \n },\n \"commits\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/commits\"\ + \n }\n },\n \"id\": kypj,\n \"title\": \"My snippet\"\ + ,\n \"created_on\": \"2014-12-29T22:22:04.790331+00:00\",\n \"updated_on\"\ + : \"2014-12-29T22:22:04.790331+00:00\",\n \"is_private\": false,\n \ + \ \"files\": {\n \"foo.txt\": {\n \"links\": {\n \ + \ \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/files/367ab19/foo.txt\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/snippets/evzijst/kypj#file-foo.txt\"\ + \n }\n }\n },\n \"image.png\": {\n \ + \ \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/files/367ab19/image.png\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/snippets/evzijst/kypj#file-image.png\"\ + \n }\n }\n }\n ],\n \"owner\": {\n \ + \ \"username\": \"evzijst\",\n \"display_name\": \"Erik van Zijst\"\ + ,\n \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\",\n \ + \ \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/evzijst\"\ + \n },\n \"avatar\": {\n \"href\": \"https://bitbucket-staging-assetroot.s3.amazonaws.com/c/photos/2013/Jul/31/erik-avatar-725122544-0_avatar.png\"\ + \n }\n }\n },\n \"creator\": {\n \"username\"\ + : \"evzijst\",\n \"display_name\": \"Erik van Zijst\",\n \"\ + uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\",\n \"links\": {\n\ + \ \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/evzijst\"\ + \n },\n \"avatar\": {\n \"href\": \"https://bitbucket-staging-assetroot.s3.amazonaws.com/c/photos/2013/Jul/31/erik-avatar-725122544-0_avatar.png\"\ + \n }\n }\n }\n }\n\n --===============1438169132528273974==\n\ + \ Content-Type: text/plain; charset=\"us-ascii\"\n MIME-Version: 1.0\n\ + \ Content-Transfer-Encoding: 7bit\n Content-ID: \"foo.txt\"\n Content-Disposition:\ + \ attachment; filename=\"foo.txt\"\n\n foo\n\n --===============1438169132528273974==\n\ + \ Content-Type: image/png\n MIME-Version: 1.0\n Content-Transfer-Encoding:\ + \ base64\n Content-ID: \"image.png\"\n Content-Disposition: attachment;\ + \ filename=\"image.png\"\n\n iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m\n\ + \ TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB\n\ + \ cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5\n\ + \ EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ\n\ + \ 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN\n\ + \ AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg==\n --===============1438169132528273974==--\n\ + \nmultipart/form-data\n-------------------\n\nAs with creating new snippets,\ + \ `multipart/form-data` can be used as an\nalternative to `multipart/related`.\ + \ However, the inherently flat\nstructure of form-data means that only basic,\ + \ root-level properties\ncan be returned, while nested elements like `links`\ + \ are omitted:\n\n $ curl -H \"Accept: multipart/form-data\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj\n\ + \nResponse:\n\n HTTP/1.1 200 OK\n Content-Length: 951\n Content-Type:\ + \ multipart/form-data; boundary=----------------------------63a4b224c59f\n\ + \n ------------------------------63a4b224c59f\n Content-Disposition:\ + \ form-data; name=\"title\"\n Content-Type: text/plain; charset=\"utf-8\"\ + \n\n My snippet\n ------------------------------63a4b224c59f--\n \ + \ Content-Disposition: attachment; name=\"file\"; filename=\"foo.txt\"\n \ + \ Content-Type: text/plain\n\n foo\n\n ------------------------------63a4b224c59f\n\ + \ Content-Disposition: attachment; name=\"file\"; filename=\"image.png\"\ + \n Content-Transfer-Encoding: base64\n Content-Type: application/octet-stream\n\ + \n iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m\n\ + \ TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB\n\ + \ cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5\n\ + \ EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ\n\ + \ 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN\n\ + \ AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg==\n ------------------------------5957323a6b76--" + produces: + - "application/json" + - "multipart/related" + - "multipart/form-data" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + description: "The snippet's id." + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 200: + description: "The snippet object." + schema: + $ref: "#/definitions/snippet" + 401: + description: "If the snippet is private and the request was not authenticated." + schema: + $ref: "#/definitions/error" + 403: + description: "If authenticated user does not have access to the private\ + \ snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + put: + tags: + - "snippets" + description: "Used to update a snippet. Use this to add and delete files and\ + \ to\nchange a snippet's title.\n\nTo update a snippet, one can either PUT\ + \ a full snapshot, or only the\nparts that need to be changed.\n\nThe contract\ + \ for PUT on this API is that properties missing from the\nrequest remain\ + \ untouched so that snippets can be efficiently\nmanipulated with differential\ + \ payloads.\n\nTo delete a property (e.g. the title, or a file), include its\ + \ name in\nthe request, but omit its value (use `null`).\n\nAs in Git, explicit\ + \ renaming of files is not supported. Instead, to\nrename a file, delete it\ + \ and add it again under another name. This can\nbe done atomically in a single\ + \ request. Rename detection is left to\nthe SCM.\n\nPUT supports three different\ + \ content types for both request and\nresponse bodies:\n\n* `application/json`\n\ + * `multipart/related`\n* `multipart/form-data`\n\nThe content type used for\ + \ the request body can be different than that\nused for the response. Content\ + \ types are specified using standard HTTP\nheaders.\n\nUse the `Content-Type`\ + \ and `Accept` headers to select the desired\nrequest and response format.\n\ + \n\napplication/json\n----------------\n\nAs with creation and retrieval,\ + \ the content type determines what\nproperties can be manipulated. `application/json`\ + \ does not support\nfile contents and is therefore limited to a snippet's\ + \ meta data.\n\nTo update the title, without changing any of its files:\n\n\ + \ $ curl -X POST -H \"Content-Type: application/json\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj\ + \ -d '{\"title\": \"Updated title\"}'\n\n\nTo delete the title:\n\ + \n $ curl -X POST -H \"Content-Type: application/json\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj\ + \ -d '{\"title\": null}'\n\nNot all parts of a snippet can be\ + \ manipulated. The owner and creator\nfor instance are immutable.\n\n\nmultipart/related\n\ + -----------------\n\n`multipart/related` can be used to manipulate all of\ + \ a snippet's\nproperties. The body is identical to a POST. properties omitted\ + \ from\nthe request are left unchanged. Since the `start` part contains JSON,\n\ + the mechanism for manipulating the snippet's meta data is identical\nto `application/json`\ + \ requests.\n\nTo update one of a snippet's file contents, while also changing\ + \ its\ntitle:\n\n PUT /2.0/snippets/evzijst/kypj HTTP/1.1\n Content-Length:\ + \ 288\n Content-Type: multipart/related; start=\"snippet\"; boundary=\"\ + ===============1438169132528273974==\"\n MIME-Version: 1.0\n\n --===============1438169132528273974==\n\ + \ Content-Type: application/json; charset=\"utf-8\"\n MIME-Version:\ + \ 1.0\n Content-ID: snippet\n\n {\n \"title\": \"My updated snippet\"\ + ,\n \"files\": {\n \"foo.txt\": {}\n }\n }\n\n \ + \ --===============1438169132528273974==\n Content-Type: text/plain; charset=\"\ + us-ascii\"\n MIME-Version: 1.0\n Content-Transfer-Encoding: 7bit\n \ + \ Content-ID: \"foo.txt\"\n Content-Disposition: attachment; filename=\"\ + foo.txt\"\n\n Updated file contents.\n\n --===============1438169132528273974==--\n\ + \nHere only the parts that are changed are included in the body. The\nother\ + \ files remain untouched.\n\nNote the use of the `files` list in the JSON\ + \ part. This list contains\nthe files that are being manipulated. This list\ + \ should have\ncorresponding multiparts in the request that contain the new\ + \ contents\nof these files.\n\nIf a filename in the `files` list does not\ + \ have a corresponding part,\nit will be deleted from the snippet, as shown\ + \ below:\n\n PUT /2.0/snippets/evzijst/kypj HTTP/1.1\n Content-Length:\ + \ 188\n Content-Type: multipart/related; start=\"snippet\"; boundary=\"\ + ===============1438169132528273974==\"\n MIME-Version: 1.0\n\n --===============1438169132528273974==\n\ + \ Content-Type: application/json; charset=\"utf-8\"\n MIME-Version:\ + \ 1.0\n Content-ID: snippet\n\n {\n \"files\": {\n \"image.png\"\ + : {}\n }\n }\n\n --===============1438169132528273974==--\n\nTo\ + \ simulate a rename, delete a file and add the same file under\nanother name:\n\ + \n PUT /2.0/snippets/evzijst/kypj HTTP/1.1\n Content-Length: 212\n \ + \ Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\"\ + \n MIME-Version: 1.0\n\n --===============1438169132528273974==\n \ + \ Content-Type: application/json; charset=\"utf-8\"\n MIME-Version: 1.0\n\ + \ Content-ID: snippet\n\n {\n \"files\": {\n \"foo.txt\"\ + : {},\n \"bar.txt\": {}\n }\n }\n\n --===============1438169132528273974==\n\ + \ Content-Type: text/plain; charset=\"us-ascii\"\n MIME-Version: 1.0\n\ + \ Content-Transfer-Encoding: 7bit\n Content-ID: \"bar.txt\"\n Content-Disposition:\ + \ attachment; filename=\"bar.txt\"\n\n foo\n\n --===============1438169132528273974==--\n\ + \n\nmultipart/form-data\n-----------------\n\nAgain, one can also use `multipart/form-data`\ + \ to manipulate file\ncontents and meta data atomically.\n\n $ curl -X\ + \ PUT http://localhost:12345/2.0/snippets/evzijst/kypj -F title=\"\ + My updated snippet\" -F file=@foo.txt\n\n PUT /2.0/snippets/evzijst/kypj\ + \ HTTP/1.1\n Content-Length: 351\n Content-Type: multipart/form-data;\ + \ boundary=----------------------------63a4b224c59f\n\n ------------------------------63a4b224c59f\n\ + \ Content-Disposition: form-data; name=\"file\"; filename=\"foo.txt\"\n\ + \ Content-Type: text/plain\n\n foo\n\n ------------------------------63a4b224c59f\n\ + \ Content-Disposition: form-data; name=\"title\"\n\n My updated snippet\n\ + \ ------------------------------63a4b224c59f\n\nTo delete a file, omit\ + \ its contents while including its name in the\n`files` field:\n\n $ curl\ + \ -X PUT https://api.bitbucket.org/2.0/snippets/evzijst/kypj -F files=image.png\n\ + \n PUT /2.0/snippets/evzijst/kypj HTTP/1.1\n Content-Length: 149\n \ + \ Content-Type: multipart/form-data; boundary=----------------------------ef8871065a86\n\ + \n ------------------------------ef8871065a86\n Content-Disposition:\ + \ form-data; name=\"files\"\n\n image.png\n ------------------------------ef8871065a86--\n\ + \nThe explicit use of the `files` element in `multipart/related` and\n`multipart/form-data`\ + \ is only required when deleting files.\nThe default mode of operation is\ + \ for file parts to be processed,\nregardless of whether or not they are listed\ + \ in `files`, as a\nconvenience to the client." + consumes: + - "application/json" + - "multipart/related" + - "multipart/form-data" + produces: + - "application/json" + - "multipart/related" + - "multipart/form-data" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + description: "The snippet's id." + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 200: + description: "The updated snippet object." + schema: + $ref: "#/definitions/snippet" + 401: + description: "If the snippet is private and the request was not authenticated." + schema: + $ref: "#/definitions/error" + 403: + description: "If authenticated user does not have permission to update the\ + \ private snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet:write" + - basic: [] + - api_key: [] + delete: + tags: + - "snippets" + description: "Deletes a snippet and returns an empty response." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + description: "The snippet's id." + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 204: + description: "If the snippet was deleted successfully." + 401: + description: "If the snippet is private and the request was not authenticated." + schema: + $ref: "#/definitions/error" + 403: + description: "If authenticated user does not have permission to delete the\ + \ private snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet:write" + - basic: [] + - api_key: [] + /addon/linkers: + get: + tags: + - "addon" + description: "" + parameters: [] + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines_config/build_number: + put: + tags: + - "pipelines" + description: "Update the next build number that should be assigned to a pipeline.\ + \ The next build number that will be configured has to be strictly higher\ + \ than the current latest build number for this repository." + operationId: "updateRepositoryBuildNumber" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The build number to update." + required: true + schema: + $ref: "#/definitions/pipeline_build_number" + x-exportParamName: "Body" + responses: + 200: + description: "The build number has been configured." + schema: + $ref: "#/definitions/pipeline_build_number" + 400: + description: "The update failed because the next number was invalid (it\ + \ should be higher than the current number)." + schema: + $ref: "#/definitions/error" + 404: + description: "The account or repository was not found." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}: + get: + tags: + - "pullrequests" + description: "Returns a specific pull request comment." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "pull_request_id" + in: "path" + required: true + type: "string" + x-exportParamName: "PullRequestId" + - name: "comment_id" + in: "path" + required: true + type: "string" + x-exportParamName: "CommentId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The comment." + schema: + $ref: "#/definitions/pullrequest_comment" + 403: + description: "If the authenticated user does not have access to the pull\ + \ request." + schema: + $ref: "#/definitions/error" + 404: + description: "If the pull request does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest" + - basic: [] + - api_key: [] + /teams/{username}/permissions/repositories: + get: + tags: [] + description: "Returns an object for each repository permission for all of a\n\ + team’s repositories.\n\nPermissions returned are effective permissions — the\ + \ highest level of\npermission the user has. This does not include public\ + \ repositories that\nusers are not granted any specific permission in, and\ + \ does not\ndistinguish between direct and indirect privileges.\n\nOnly users\ + \ with admin permission for the team may access this resource.\n\nPermissions\ + \ can be:\n\n* `admin`\n* `write`\n* `read`\n\nExample:\n\n```\n$ curl https://api.bitbucket.org/2.0/teams/atlassian_tutorial/permissions/repositories\n\ + \n{\n \"pagelen\": 10,\n \"values\": [\n {\n \"type\": \"repository_permission\"\ + ,\n \"user\": {\n \"type\": \"user\",\n \"username\": \"\ + evzijst\",\n \"display_name\": \"Erik van Zijst\",\n \"uuid\"\ + : \"{d301aafa-d676-4ee0-88be-962be7417567}\"\n },\n \"repository\"\ + : {\n \"type\": \"repository\",\n \"name\": \"geordi\",\n \ + \ \"full_name\": \"bitbucket/geordi\",\n \"uuid\": \"{85d08b4e-571d-44e9-a507-fa476535aa98}\"\ + \n },\n \"permission\": \"admin\"\n },\n {\n \"type\"\ + : \"repository_permission\",\n \"user\": {\n \"type\": \"user\"\ + ,\n \"username\": \"seanaty\",\n \"display_name\": \"Sean Conaty\"\ + ,\n \"uuid\": \"{504c3b62-8120-4f0c-a7bc-87800b9d6f70}\"\n },\n\ + \ \"repository\": {\n \"type\": \"repository\",\n \"name\"\ + : \"geordi\",\n \"full_name\": \"bitbucket/geordi\",\n \"uuid\"\ + : \"{85d08b4e-571d-44e9-a507-fa476535aa98}\"\n },\n \"permission\"\ + : \"write\"\n }\n ],\n \"page\": 1,\n \"size\": 2\n}\n```\n\nResults\ + \ may be further [filtered or sorted](../../../../meta/filtering)\nby repository,\ + \ user, or permission by adding the following query string\nparameters:\n\n\ + * `q=repository.name=\"geordi\"` or `q=permission>\"read\"`\n* `sort=user.display_name`\n\ + \nNote that the query parameter values need to be URL escaped so that `=`\n\ + would become `%3D`." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the team,\nsurrounded\ + \ by curly-braces, for example: `{team UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "q" + in: "query" + description: "\nQuery string to narrow down the response as per\n[filtering\ + \ and sorting](../../../../meta/filtering)." + required: false + type: "string" + x-exportParamName: "Q" + - name: "sort" + in: "query" + description: "\nName of a response property sort the result by as per\n[filtering\ + \ and sorting](../../../../meta/filtering#query-sort).\n" + required: false + type: "string" + x-exportParamName: "Sort" + responses: + 200: + description: "Something something" + schema: + $ref: "#/definitions/paginated_repository_permissions" + 403: + description: "The requesting user isn't an admin of the team." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "team" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/filehistory/{node}/{path}: + get: + tags: + - "source" + - "repositories" + description: "Returns a paginated list of commits that modified the specified\ + \ file.\n\nCommits are returned in reverse chronological order. This is roughly\n\ + equivalent to the following commands:\n\n $ git log --follow --date-order\ + \ \n\n $ hg log --follow \n\nBy default, Bitbucket will\ + \ follow renames and the path name in the\nreturned entries reflects that.\ + \ This can be turned off using the\n`?renames=false` query parameter.\n\n\ + Results are returned in descending chronological order by default, and\nlike\ + \ most endpoints you can\n[filter and sort](../../../../../../meta/filtering)\ + \ the response to\nonly provide exactly the data you want.\n\nFor example,\ + \ if you wanted to find commits made before 2011-05-18\nagainst a file named\ + \ `README.rst`, but you only wanted the path and\ndate, your query would look\ + \ like this:\n\n```\n$ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\\\ + \n '?fields=values.next,values.path,values.commit.date&q=commit.date<=2011-05-18'\n\ + {\n \"values\": [\n {\n \"commit\": {\n \"date\": \"2011-05-17T07:32:09+00:00\"\ + \n },\n \"path\": \"README.rst\"\n },\n {\n \"commit\"\ + : {\n \"date\": \"2011-05-16T06:33:28+00:00\"\n },\n \"path\"\ + : \"README.txt\"\n },\n {\n \"commit\": {\n \"date\": \"\ + 2011-05-16T06:15:39+00:00\"\n },\n \"path\": \"README.txt\"\n \ + \ }\n ]\n}\n```\n\nIn the response you can see that the file was renamed\ + \ to `README.rst`\nby the commit made on 2011-05-16, and was previously named\ + \ `README.txt`." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "node" + in: "path" + required: true + type: "string" + x-exportParamName: "Node" + - name: "path" + in: "path" + required: true + type: "string" + x-exportParamName: "Path" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "renames" + in: "query" + description: "\nWhen `true`, Bitbucket will follow the history of the file\ + \ across\nrenames (this is the default behavior). This can be turned off\ + \ by\nspecifying `false`." + required: false + type: "string" + x-exportParamName: "Renames" + - name: "q" + in: "query" + description: "\nQuery string to narrow down the response as per\n[filtering\ + \ and sorting](../../../../../../meta/filtering)." + required: false + type: "string" + x-exportParamName: "Q" + - name: "sort" + in: "query" + description: "\nName of a response property sort the result by as per\n[filtering\ + \ and sorting](../../../../../../meta/filtering#query-sort).\n" + required: false + type: "string" + x-exportParamName: "Sort" + responses: + 200: + description: "A paginated list of commits that modified the specified file" + schema: + $ref: "#/definitions/paginated_files" + 404: + description: "If the repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /users/{username}/hooks: + get: + tags: + - "users" + - "webhooks" + description: "Returns a paginated list of webhooks installed on this user account." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "The paginated list of installed webhooks." + schema: + $ref: "#/definitions/paginated_webhook_subscriptions" + 403: + description: "If the authenticated user is accessing an account other than\ + \ their own." + schema: + $ref: "#/definitions/error" + 404: + description: "If the specified account does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + post: + tags: + - "users" + - "webhooks" + description: "Creates a new webhook on the specified user account.\n\nAccount-level\ + \ webhooks are fired for events from all repositories\nbelonging to that account.\n\ + \nNote that one can only register webhooks on one's own account, not that\n\ + of others." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + responses: + 201: + description: "The newly installed webhook." + schema: + $ref: "#/definitions/webhook_subscription" + headers: + Location: + type: "string" + description: "The URL of new newly created webhook." + 403: + description: "If the authenticated user is accessing an account other than\ + \ their own." + schema: + $ref: "#/definitions/error" + 404: + description: "If the specified account does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/components/{component_id}: + get: + tags: + - "issue_tracker" + description: "Returns the specified issue tracker component object." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "component_id" + in: "path" + description: "The component's id" + required: true + type: "integer" + x-exportParamName: "ComponentId" + responses: + 200: + description: "The specified component object." + schema: + $ref: "#/definitions/component" + 404: + description: "If the specified repository or component does not exist, or\ + \ if the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + /addon: + put: + tags: + - "addon" + description: "" + parameters: [] + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + delete: + tags: + - "addon" + description: "" + parameters: [] + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}: + get: + tags: + - "pipelines" + description: "Retrieve a specified pipeline" + operationId: "getPipelineForRepository" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pipeline_uuid" + in: "path" + description: "The pipeline UUID." + required: true + type: "string" + x-exportParamName: "PipelineUuid" + responses: + 200: + description: "The pipeline." + schema: + $ref: "#/definitions/pipeline" + 404: + description: "No account, repository or pipeline with the UUID provided\ + \ exists." + schema: + $ref: "#/definitions/error" + /users/{username}/following: + get: + tags: + - "users" + description: "Returns the list of accounts this user is following." + parameters: + - name: "username" + in: "path" + description: "The user's username" + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "A paginated list of user objects." + schema: + $ref: "#/definitions/paginated_users" + 404: + description: "If no user exists for the specified name, or if the specified\ + \ account is a team account, not a personal account." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "account" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/issues/{issue_id}: + get: + tags: + - "issue_tracker" + description: "Returns the specified issue." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "issue_id" + in: "path" + required: true + type: "string" + x-exportParamName: "IssueId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The issue object." + schema: + $ref: "#/definitions/issue" + 403: + description: "When the authenticated user lacks isn't authorized to access\ + \ the issue tracker." + schema: + $ref: "#/definitions/error" + 404: + description: "If the specified repository or issue does not exist, or if\ + \ the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + put: + tags: + - "issue_tracker" + description: "Modifies the issue.\n\n```\n$ curl https://api.bitbucket.org/2.0/repostories/evzijst/dogslow/issues/123\ + \ \\\n -u evzijst -s -X PUT -H 'Content-Type: application/json' \\\n -d\ + \ '{\n \"title\": \"Updated title\",\n \"assignee\": {\n \"username\"\ + : \"evzijst\"\n },\n \"priority\": \"minor\",\n \"version\": {\n \"\ + name\": \"1.0\"\n },\n \"component\": null\n}'\n```\n\nThe example above\ + \ changes the `title`, `assignee`, `priority` and the\n`version`. It also\ + \ removes the `component` from the issue by setting the\nfield explicitly\ + \ to `null`. Any field that is not present will keep its\nexisting value.\n\ + \nNote that the issue tracker keeps a list of all modifications made to\n\ + an issue under the `/issues/123/changes` endpoint and a PUT to this\nendpoint\ + \ will create a new changes record.\n\nIssues can also be manipulated by POSTing\ + \ directly to the issue\n`/changes` endpoint. This is equivalent to a PUT\ + \ here, except that the\nclient is able to provide a message that will be\ + \ stored alongside the\nchange record." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue id" + required: true + type: "string" + x-exportParamName: "IssueId" + responses: + 200: + description: "The updated issue object." + schema: + $ref: "#/definitions/issue" + 403: + description: "When the authenticated user lacks isn't authorized to access\ + \ the issue tracker." + schema: + $ref: "#/definitions/error" + 404: + description: "If the specified repository or issue does not exist, or if\ + \ the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue:write" + - basic: [] + - api_key: [] + delete: + tags: + - "issue_tracker" + description: "Deletes the specified issue. This requires write access to the\n\ + repository." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "issue_id" + in: "path" + required: true + type: "string" + x-exportParamName: "IssueId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The issue object." + schema: + $ref: "#/definitions/issue" + 403: + description: "When the authenticated user lacks isn't authorized to delete\ + \ the issue tracker." + schema: + $ref: "#/definitions/error" + 404: + description: "If the specified repository or issue does not exist, or if\ + \ the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue:write" + - basic: [] + - api_key: [] + /teams/{username}/repositories: + get: + tags: + - "users" + - "teams" + description: "All repositories owned by a user/team. This includes private\n\ + repositories, but filtered down to the ones that the calling user has\naccess\ + \ to." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/downloads: + get: + tags: + - "downloads" + description: "Returns a list of download links associated with the repository." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + post: + tags: + - "downloads" + description: "Upload new download artifacts.\n\nTo upload files, perform a `multipart/form-data`\ + \ POST containing one\nor more `files` fields:\n\n $ echo Hello World >\ + \ hello.txt\n $ curl -s -u evzijst -X POST https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads\ + \ -F files=@hello.txt\n\nWhen a file is uploaded with the same name as an\ + \ existing artifact,\nthen the existing file will be replaced." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/refs: + get: + tags: + - "refs" + description: "" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines_config/variables/{variable_uuid}: + get: + tags: + - "pipelines" + description: "Retrieve a repository level variable." + operationId: "getRepositoryPipelineVariable" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "variable_uuid" + in: "path" + description: "The UUID of the variable to retrieve." + required: true + type: "string" + x-exportParamName: "VariableUuid" + responses: + 200: + description: "The variable." + schema: + $ref: "#/definitions/pipeline_variable" + 404: + description: "The account, repository or variable with the specified UUID\ + \ was not found." + schema: + $ref: "#/definitions/error" + put: + tags: + - "pipelines" + description: "Update a repository level variable." + operationId: "updateRepositoryPipelineVariable" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "variable_uuid" + in: "path" + description: "The UUID of the variable to update." + required: true + type: "string" + x-exportParamName: "VariableUuid" + - in: "body" + name: "_body" + description: "The updated variable" + required: true + schema: + $ref: "#/definitions/pipeline_variable" + x-exportParamName: "Body" + responses: + 200: + description: "The variable was updated." + schema: + $ref: "#/definitions/pipeline_variable" + 404: + description: "The account, repository or variable with the given UUID was\ + \ not found." + schema: + $ref: "#/definitions/error" + delete: + tags: + - "pipelines" + description: "Delete a repository level variable." + operationId: "deleteRepositoryPipelineVariable" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "variable_uuid" + in: "path" + description: "The UUID of the variable to delete." + required: true + type: "string" + x-exportParamName: "VariableUuid" + responses: + 204: + description: "The variable was deleted." + 404: + description: "The account, repository or variable with given UUID was not\ + \ found." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/stopPipeline: + post: + tags: + - "pipelines" + description: "Signal the stop of a pipeline and all of its steps that not have\ + \ completed yet." + operationId: "stopPipeline" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pipeline_uuid" + in: "path" + description: "The UUID of the pipeline." + required: true + type: "string" + x-exportParamName: "PipelineUuid" + responses: + 204: + description: "The pipeline has been signaled to stop." + 400: + description: "The specified pipeline has already completed." + schema: + $ref: "#/definitions/error" + 404: + description: "Either the account, repository or pipeline with the given\ + \ UUID does not exist." + schema: + $ref: "#/definitions/error" + /hook_events: + get: + tags: + - "webhooks" + description: "Returns the webhook resource or subject types on which webhooks\ + \ can\nbe registered.\n\nEach resource/subject type contains an `events` link\ + \ that returns the\npaginated list of specific events each individual subject\ + \ type can\nemit.\n\nThis endpoint is publicly accessible and does not require\n\ + authentication or scopes.\n\nExample:\n\n```\n$ curl https://api.bitbucket.org/2.0/hook_events\n\ + \n{\n \"repository\": {\n \"links\": {\n \"events\":\ + \ {\n \"href\": \"https://api.bitbucket.org/2.0/hook_events/repository\"\ + \n }\n }\n },\n \"team\": {\n \"links\": {\n\ + \ \"events\": {\n \"href\": \"https://api.bitbucket.org/2.0/hook_events/team\"\ + \n }\n }\n },\n \"user\": {\n \"links\": {\n\ + \ \"events\": {\n \"href\": \"https://api.bitbucket.org/2.0/hook_events/user\"\ + \n }\n }\n }\n}\n```" + parameters: [] + responses: + 200: + description: "A mapping of resource/subject types pointing to their individual\ + \ event types." + schema: + $ref: "#/definitions/subject_types" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /teams/{username}: + get: + tags: + - "teams" + description: "Gets the public information associated with a team.\n\nIf the\ + \ team's profile is private, `location`, `website` and\n`created_on` elements\ + \ are omitted." + parameters: + - name: "username" + in: "path" + description: "The team's username or UUID." + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "The team object" + schema: + $ref: "#/definitions/team" + 404: + description: "If no team exists for the specified name or UUID, or if the\ + \ specified account is a personal account, not a team account." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /user/emails/{email}: + get: + tags: + - "users" + description: "Returns details about a specific one of the authenticated user's\n\ + email addresses.\n\nDetails describe whether the address has been confirmed\ + \ by the user and\nwhether it is the user's primary address or not." + parameters: + - name: "email" + in: "path" + required: true + type: "string" + x-exportParamName: "Email" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "email" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/approve: + post: + tags: + - "pullrequests" + description: "Approve the specified pull request as the authenticated user." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "pull_request_id" + in: "path" + required: true + type: "string" + x-exportParamName: "PullRequestId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The `participant` object recording that the authenticated\ + \ user approved the pull request." + schema: + $ref: "#/definitions/participant" + 404: + description: "The specified pull request or the repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest:write" + - basic: [] + - api_key: [] + delete: + tags: + - "pullrequests" + description: "Redact the authenticated user's approval of the specified pull\n\ + request." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "pull_request_id" + in: "path" + required: true + type: "string" + x-exportParamName: "PullRequestId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 204: + description: "An empty response indicating the authenticated user's approval\ + \ has been withdrawn." + 404: + description: "The specified pull request or the repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/patch/{spec}: + get: + tags: + - "commits" + description: "Produces a raw patch for a single commit (diffed against its first\n\ + parent), or a patch-series for a revspec of 2 commits (e.g.\n`3a8b42..9ff173`\ + \ where the first commit represents the source and the\nsecond commit the\ + \ destination).\n\nIn case of the latter (diffing a revspec), a patch series\ + \ is returned\nfor the commits on the source branch (`3a8b42` and its ancestors\ + \ in\nour example). For Mercurial, a single patch is returned that combines\n\ + the changes of all commits on the source branch.\n\nWhile similar to diffs,\ + \ patches:\n\n* Have a commit header (username, commit message, etc)\n* Do\ + \ not support the `path=foo/bar.py` query parameter\n\nThe raw patch is returned\ + \ as-is, in whatever encoding the files in the\nrepository use. It is not\ + \ decoded into unicode. As such, the\ncontent-type is `text/plain`." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "spec" + in: "path" + required: true + type: "string" + x-exportParamName: "Spec" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The raw patches" + 555: + description: "If the diff was too large and timed out.\n\nSince this endpoint\ + \ does not employ any form of pagination, but\ninstead returns the diff\ + \ as a single document, it can run into\ntrouble on very large diffs.\ + \ If Bitbucket times out in cases\nlike these, a 555 status code is returned." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines_config: + get: + tags: + - "pipelines" + description: "Retrieve the repository pipelines configuration." + operationId: "getRepositoryPipelineConfig" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The repository pipelines configuration." + schema: + $ref: "#/definitions/pipelines_config" + put: + tags: + - "pipelines" + description: "Update the pipelines configuration for a repository." + operationId: "updateRepositoryPipelineConfig" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The updated repository pipelines configuration." + required: true + schema: + $ref: "#/definitions/pipelines_config" + x-exportParamName: "Body" + responses: + 200: + description: "The repository pipelines configuration was updated." + schema: + $ref: "#/definitions/pipelines_config" + /repositories/{username}/{repo_slug}/forks: + get: + tags: + - "repositories" + description: "Returns a paginated list of all the forks of the specified\nrepository." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "All forks." + schema: + $ref: "#/definitions/paginated_repositories" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + post: + tags: + - "repositories" + description: "Creates a new fork of the specified repository.\n\nBy default,\ + \ forks are created under the authenticated user's account\nwith the same\ + \ name and slug of the original repository.\n\n```\n$ curl -X POST -u jdoe\ + \ https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/forks\n\n{\n\ + \ \"scm\": \"git\",\n \"full_name\": \"jdoe/dogslow\",\n \"parent\": {\n\ + \ \"full_name\": \"evzijst/dogslow\",\n ...\n },\n ...\n}\n```\n\n\ + If you already have a repo with that name, then a 400 is returned and\nyou'll\ + \ need to specify a custom name for the new fork:\n\n```\n$ curl -X POST -u\ + \ jdoe https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/forks \\\ + \n -H 'Content-Type: application/json' -d '{\n \"name\": \"dogslow_fork\"\ + \n}'\n```\n\nWhen you specify a value for `name`, it will also affect the\ + \ `slug`.\nThe `slug` is reflected in the repository URL of the new fork.\ + \ It is\nderived from `name` by substituting non-ASCII characters, removes\n\ + whitespace, and changes characters to lower case. For example,\n`My repo`\ + \ would turn into `my_repo`.\n\n## Forking a repository into a team account\n\ + \nTo create a fork into a team account, specify the new owner's account\n\ + explicitly as part of the request body. This prevents forked\nrepositories\ + \ from being owned by the authenticated user submitting the\nrequest:\n\n\ + ```\n$ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/atlassian/bbql/forks\ + \ \\\n -H 'Content-Type: application/json' -d '{\n \"name\": \"bbql_fork\"\ + ,\n \"owner\": {\n \"username\": \"atlassian\"\n }\n}'\n```\n\n\ + To fork a repository into the same team, also specify a new `name`.\n\nYou\ + \ need contributor access to create new forks within a team account.\n\n\n\ + ## Change the properties of a new fork\n\nBy default the fork inherits most\ + \ of its properties from the parent.\nHowever, since the optional POST body\ + \ document follows the normal\n`repository` JSON schema and you can override\ + \ the new fork's\nproperties.\n\nProperties that can be overridden include:\n\ + \n* description\n* fork_policy\n* language\n* mainbranch\n* is_private (note\ + \ that a private repo's fork_policy might prohibit\n the creation of public\ + \ forks, in which `is_private=False` would fail)\n* has_issues (to initialize\ + \ or disable the new repo's issue tracker --\n note that the actual contents\ + \ of the parent repository's issue\n tracker are not copied during forking)\n\ + * has_wiki (to initialize or disable the new repo's wiki --\n note that the\ + \ actual contents of the parent repository's wiki are not\n copied during\ + \ forking)\n* project (only teams have projects and when forking into a private\n\ + \ project, the fork's `is_private` must be `true`)\n\nProperties that cannot\ + \ be modified include:\n\n* scm\n* parent\n* full_name" + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "A repository object. This can be left blank." + required: false + schema: + $ref: "#/definitions/repository" + x-exportParamName: "Body" + responses: + 201: + description: "The newly created fork." + schema: + $ref: "#/definitions/repository" + headers: + Location: + type: "string" + description: "The URL of the newly created fork" + security: + - oauth2: + - "repository:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/issues: + get: + tags: + - "issue_tracker" + description: "Returns the issues in the issue tracker." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "A paginated list of the issues matching any filter criteria\ + \ that were provided." + schema: + $ref: "#/definitions/paginated_issues" + 404: + description: "If the specified repository or version does not exist, or\ + \ if the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + post: + tags: + - "issue_tracker" + description: "Creates a new issue.\n\nThis call requires authentication. Private\ + \ repositories or private\nissue trackers require the caller to authenticate\ + \ with an account that\nhas appropriate authorisation.\n\nThe authenticated\ + \ user is used for the issue's `reporter` field." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The new issue. Note that the only required element is `title`.\ + \ All other elements can be omitted from the body." + required: true + schema: + $ref: "#/definitions/issue" + x-exportParamName: "Body" + responses: + 201: + description: "The newly created issue." + schema: + $ref: "#/definitions/issue" + headers: + Location: + type: "string" + description: "The (absolute) URL of the newly created issue." + 401: + description: "When the request wasn't authenticated." + schema: + $ref: "#/definitions/error" + 403: + description: "When the authenticated user lacks the privilege to create\ + \ issues in the issue tracker." + schema: + $ref: "#/definitions/error" + 404: + description: "If the specified repository or version does not exist, or\ + \ if the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines_config/schedules/: + get: + tags: + - "pipelines" + description: "Retrieve the configured schedules for the given repository." + operationId: "getRepositoryPipelineSchedules" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The list of schedules." + schema: + $ref: "#/definitions/paginated_pipeline_schedules" + 404: + description: "The account or repository was not found." + schema: + $ref: "#/definitions/error" + post: + tags: + - "pipelines" + description: "Create a schedule for the given repository." + operationId: "createRepositoryPipelineSchedule" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The schedule to create." + required: true + schema: + $ref: "#/definitions/pipeline_schedule" + x-exportParamName: "Body" + responses: + 201: + description: "The created schedule." + schema: + $ref: "#/definitions/pipeline_schedule" + 400: + description: "There were errors validating the request." + schema: + $ref: "#/definitions/error" + 401: + description: "The maximum limit of schedules for this repository was reached." + schema: + $ref: "#/definitions/error" + 404: + description: "The account or repository was not found." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/: + get: + tags: + - "pipelines" + description: "Find steps for the given pipeline." + operationId: "getPipelineStepsForRepository" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pipeline_uuid" + in: "path" + description: "The UUID of the pipeline." + required: true + type: "string" + x-exportParamName: "PipelineUuid" + responses: + 200: + description: "The steps." + schema: + $ref: "#/definitions/paginated_pipeline_steps" + /repositories/{username}/{repo_slug}/issues/{issue_id}/attachments: + get: + tags: + - "issue_tracker" + description: "Returns all attachments for this issue.\n\nThis returns the files'\ + \ meta data. This does not return the files'\nactual contents.\n\nThe files\ + \ are always ordered by their upload date." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue's id" + required: true + type: "integer" + x-exportParamName: "IssueId" + responses: + 200: + description: "A paginated list of all attachments for this issue." + schema: + $ref: "#/definitions/paginated_issue_attachments" + 401: + description: "If the issue tracker is private and the request was not authenticated." + 404: + description: "If the specified repository or version does not exist, or\ + \ if the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + post: + tags: + - "issue_tracker" + description: "Upload new issue attachments.\n\nTo upload files, perform a `multipart/form-data`\ + \ POST containing one\nor more file fields.\n\nWhen a file is uploaded with\ + \ the same name as an existing attachment,\nthen the existing file will be\ + \ replaced." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue's id" + required: true + type: "integer" + x-exportParamName: "IssueId" + responses: + 201: + description: "An empty response document." + headers: + Location: + type: "string" + description: "The URL to the issue's collection of attachments." + 400: + description: "If no files were uploaded, or if the wrong `Content-Type`\ + \ was used." + 401: + description: "If the issue tracker is private and the request was not authenticated." + 404: + description: "If the specified repository or issue does not exist, or if\ + \ the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/versions: + get: + tags: + - "issue_tracker" + description: "Returns the versions that have been defined in the issue tracker.\n\ + \nThis resource is only available on repositories that have the issue\ntracker\ + \ enabled." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The versions that have been defined in the issue tracker." + schema: + $ref: "#/definitions/paginated_versions" + 404: + description: "If the specified repository does not exist, or if the repository\ + \ doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + /user/permissions/teams: + get: + tags: [] + description: "Returns an object for each team the caller is a member of, and\ + \ their\neffective role — the highest level of privilege the caller has. If\ + \ a\nuser is a member of multiple groups with distinct roles, only the\nhighest\ + \ level is returned.\n\nPermissions can be:\n\n* `admin`\n* `collaborator`\n\ + \nExample:\n\n```\n$ curl https://api.bitbucket.org/2.0/user/permissions/teams\n\ + \n{\n \"pagelen\": 10,\n \"values\": [\n {\n \"permission\": \"\ + admin\",\n \"type\": \"team_permission\",\n \"user\": {\n \ + \ \"type\": \"user\",\n \"username\": \"evzijst\",\n \"display_name\"\ + : \"Erik van Zijst\",\n \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\"\ + \n },\n \"team\": {\n \"username\": \"bitbucket\",\n \ + \ \"display_name\": \"Atlassian Bitbucket\",\n \"uuid\": \"{4cc6108a-a241-4db0-96a5-64347ac04f87}\"\ + \n }\n }\n ],\n \"page\": 1,\n \"size\": 1\n}\n```\n\nResults may\ + \ be further [filtered or sorted](../../../meta/filtering) by\nteam or permission\ + \ by adding the following query string parameters:\n\n* `q=team.username=\"\ + bitbucket\"` or `q=permission=\"admin\"`\n* `sort=team.display_name`\n\nNote\ + \ that the query parameter values need to be URL escaped so that `=`\nwould\ + \ become `%3D`." + parameters: + - name: "q" + in: "query" + description: "\nQuery string to narrow down the response as per\n[filtering\ + \ and sorting](../../../meta/filtering)." + required: false + type: "string" + x-exportParamName: "Q" + - name: "sort" + in: "query" + description: "\nName of a response property sort the result by as per\n[filtering\ + \ and sorting](../../../meta/filtering#query-sort).\n" + required: false + type: "string" + x-exportParamName: "Sort" + responses: + 200: + description: "Team permissions for the teams a caller is a member of." + schema: + $ref: "#/definitions/paginated_team_permissions" + security: + - oauth2: + - "account" + - basic: [] + - api_key: [] + /teams/{username}/hooks/{uid}: + get: + tags: + - "teams" + - "webhooks" + description: "Returns the webhook with the specified id installed on the given\n\ + team account." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "uid" + in: "path" + description: "The installed webhook's id." + required: true + type: "string" + x-exportParamName: "Uid" + responses: + 200: + description: "The webhook subscription object." + schema: + $ref: "#/definitions/webhook_subscription" + 404: + description: "If the webhook or team does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + put: + tags: + - "teams" + - "webhooks" + description: "Updates the specified webhook subscription.\n\nThe following properties\ + \ can be mutated:\n\n* `description`\n* `url`\n* `active`\n* `events`" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "uid" + in: "path" + description: "The installed webhook's id" + required: true + type: "string" + x-exportParamName: "Uid" + responses: + 200: + description: "The webhook subscription object." + schema: + $ref: "#/definitions/webhook_subscription" + 403: + description: "If the authenticated user does not have permission to update\ + \ the webhook." + schema: + $ref: "#/definitions/error" + 404: + description: "If the webhook or team does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + delete: + tags: + - "teams" + - "webhooks" + description: "Deletes the specified webhook subscription from the given team\n\ + account." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "uid" + in: "path" + description: "The installed webhook's id" + required: true + type: "string" + x-exportParamName: "Uid" + responses: + 204: + description: "When the webhook was deleted successfully" + 403: + description: "If the authenticated user does not have permission to delete\ + \ the webhook." + schema: + $ref: "#/definitions/error" + 404: + description: "If the webhook or team does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/: + get: + tags: + - "pipelines" + description: "Find repository level known hosts." + operationId: "getRepositoryPipelineKnownHosts" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The retrieved known hosts." + schema: + $ref: "#/definitions/paginated_pipeline_known_hosts" + post: + tags: + - "pipelines" + description: "Create a repository level known host." + operationId: "createRepositoryPipelineKnownHost" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The known host to create." + required: true + schema: + $ref: "#/definitions/pipeline_known_host" + x-exportParamName: "Body" + responses: + 201: + description: "The known host was created." + schema: + $ref: "#/definitions/pipeline_known_host" + headers: + Location: + type: "string" + description: "The URL of the newly created pipeline known host." + 404: + description: "The account or repository does not exist." + schema: + $ref: "#/definitions/error" + 409: + description: "A known host with the provided hostname already exists." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/refs/tags/{name}: + get: + tags: + - "refs" + description: "" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "name" + in: "path" + required: true + type: "string" + x-exportParamName: "Name" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /snippets/{username}/{encoded_id}/watch: + get: + tags: + - "snippets" + description: "Used to check if the current user is watching a specific snippet.\n\ + \nReturns 204 (No Content) if the user is watching the snippet and 404 if\n\ + not.\n\nHitting this endpoint anonymously always returns a 404." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + description: "The snippet id." + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 204: + description: "If the authenticated user is watching the snippet." + schema: + $ref: "#/definitions/paginated_users" + 404: + description: "If the snippet does not exist, or if the authenticated user\ + \ is not watching the snippet." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + put: + tags: + - "snippets" + description: "Used to start watching a specific snippet. Returns 204 (No Content)." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + description: "The snippet id." + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 204: + description: "Indicates the authenticated user is now watching the snippet." + schema: + $ref: "#/definitions/paginated_users" + 401: + description: "If the request was not authenticated." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet:write" + - basic: [] + - api_key: [] + delete: + tags: + - "snippets" + description: "Used to stop watching a specific snippet. Returns 204 (No Content)\n\ + to indicate success." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + description: "The snippet id." + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 204: + description: "Indicates the user stopped watching the snippet successfully." + schema: + $ref: "#/definitions/paginated_users" + 401: + description: "If the request was not authenticated." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/diff: + get: + tags: + - "pullrequests" + description: "" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "pull_request_id" + in: "path" + required: true + type: "string" + x-exportParamName: "PullRequestId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/src/{node}/{path}: + get: + tags: + - "source" + - "repositories" + description: "This endpoints is used to retrieve the contents of a single file,\n\ + or the contents of a directory at a specified revision.\n\n## Raw file contents\n\ + \nWhen `path` points to a file, this endpoint returns the raw contents.\n\ + The response's Content-Type is derived from the filename\nextension (not from\ + \ the contents). The file contents are not processed\nand no character encoding/recoding\ + \ is performed and as a result no\ncharacter encoding is included as part\ + \ of the Content-Type.\n\nThe `Content-Disposition` header will be \"attachment\"\ + \ to prevent\nbrowsers from running executable files.\n\nIf the file is managed\ + \ by LFS, then a 301 redirect pointing to\nAtlassian's media services platform\ + \ is returned.\n\nThe response includes an ETag that is based on the contents\ + \ of the file\nand its attributes. This means that an empty `__init__.py`\ + \ always\nreturns the same ETag, regardless on the directory it lives in,\ + \ or the\ncommit it is on.\n\n## File meta data\n\nWhen the request for a\ + \ file path includes the query parameter\n`?format=meta`, instead of returning\ + \ the file's raw contents, Bitbucket\ninstead returns the JSON object describing\ + \ the file's properties:\n\n```javascript\n$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests/__init__.py?format=meta\n\ + {\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\"\ + \n },\n \"meta\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\"\ + \n }\n },\n \"path\": \"tests/__init__.py\",\n \"commit\": {\n \"\ + type\": \"commit\",\n \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\"\ + ,\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\"\ + \n }\n }\n },\n \"attributes\": [],\n \"type\": \"commit_file\"\ + ,\n \"size\": 0\n}\n```\n\nFile objects contain an `attributes` element that\ + \ contains a list of\npossible modifiers. Currently defined values are:\n\n\ + * `link` -- indicates that the entry is a symbolic link. The contents\n \ + \ of the file represent the path the link points to.\n* `executable` -- indicates\ + \ that the file has the executable bit set.\n* `subrepository` -- indicates\ + \ that the entry points to a submodule or\n subrepo. The contents of the\ + \ file is the SHA1 of the repository\n pointed to.\n* `binary` -- indicates\ + \ whether Bitbucket thinks the file is binary.\n\nThis endpoint can provide\ + \ an alternative to how a HEAD request can be\nused to check for the existence\ + \ of a file, or a file's size without\nincurring the overhead of receiving\ + \ its full contents.\n\n\n## Directory listings\n\nWhen `path` points to a\ + \ directory instead of a file, the response is a\npaginated list of directory\ + \ and file objects in the same order as the\nunderlying SCM system would return\ + \ them.\n\nFor example:\n\n```javascript\n$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests\n\ + {\n \"pagelen\": 10,\n \"values\": [\n {\n \"path\": \"tests/test_project\"\ + ,\n \"type\": \"commit_directory\",\n \"links\": {\n \"self\"\ + : {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\"\ + \n },\n \"meta\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\"\ + \n }\n },\n \"commit\": {\n \"type\": \"commit\",\n\ + \ \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\",\n \ + \ \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\"\ + \n }\n }\n }\n },\n {\n \"links\": {\n \ + \ \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\"\ + \n },\n \"meta\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\"\ + \n }\n },\n \"path\": \"tests/__init__.py\",\n \"commit\"\ + : {\n \"type\": \"commit\",\n \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\"\ + ,\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\"\ + \n }\n }\n },\n \"attributes\": [],\n \"type\"\ + : \"commit_file\",\n \"size\": 0\n }\n ],\n \"page\": 1,\n \"size\"\ + : 2\n}\n```\n\nWhen listing the contents of the repo's root directory, the\ + \ use of a\ntrailing slash at the end of the URL is required.\n\nThe response\ + \ is not recursive, meaning that only the direct contents of\na path are returned.\ + \ The response does not recurse down into\nsubdirectories. In order to \"\ + walk\" the entire directory tree, the\nclient needs to parse each response\ + \ and follow the `self` links of each\n`commit_directory` object.\n\nEach\ + \ returned object is either a `commit_file`, or a `commit_directory`,\nboth\ + \ of which contain a `path` element. This path is the absolute path\nfrom\ + \ the root of the repository. Each object also contains a `commit`\nobject\ + \ which embeds the commit the file is on. Note that this is merely\nthe commit\ + \ that was used in the URL. It is *not* the commit that last\nmodified the\ + \ file.\n\nDirectory objects have 2 representations. Their `self` link returns\ + \ the\npaginated contents of the directory. The `meta` link on the other hand\n\ + returns the actual `directory` object itself, e.g.:\n\n```javascript\n{\n\ + \ \"path\": \"tests/test_project\",\n \"type\": \"commit_directory\",\n\ + \ \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\"\ + \n },\n \"meta\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\"\ + \n }\n },\n \"commit\": { ... }\n}\n```\n\n## Querying, filtering and\ + \ sorting\n\nLike most API endpoints, this API supports the Bitbucket\nquerying/filtering\ + \ syntax and so you could filter a directory listing\nto only include entries\ + \ that match certain criteria. For instance, to\nlist all binary files over\ + \ 1kb use the expression:\n\n`size > 1024 and attributes = \"binary\"`\n\n\ + which after urlencoding yields the query string:\n\n`?q=size%3E1024+and+attributes%3D%22binary%22`\n\ + \nTo change the ordering of the response, use the `?sort` parameter:\n\n`.../src/eefd5ef/?sort=-size`\n\ + \nSee [filtering and sorting](../../../../../../meta/filtering) for more\n\ + details." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "node" + in: "path" + required: true + type: "string" + x-exportParamName: "Node" + - name: "path" + in: "path" + required: true + type: "string" + x-exportParamName: "Path" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "format" + in: "query" + description: "If 'meta' is provided, returns the (json) meta data for the\ + \ contents of the file. If 'rendered' is provided, returns the contents\ + \ of a non-binary file in HTML-formatted rendered markup. Since Git and\ + \ Mercurial do not generally track what text encoding scheme is used, this\ + \ endpoint attempts to detect the most appropriate character encoding. While\ + \ usually correct, determining the character encoding can be ambiguous which\ + \ in exceptional cases can lead to misinterpretation of the characters.\ + \ As such, the raw element in the response object should not be treated\ + \ as equivalent to the file's actual contents." + required: false + type: "string" + enum: + - "meta" + - "rendered" + x-exportParamName: "Format" + - name: "q" + in: "query" + description: "Optional filter expression as per [filtering and sorting](../../../../../../meta/filtering)." + required: false + type: "string" + x-exportParamName: "Q" + - name: "sort" + in: "query" + description: "Optional sorting parameter as per [filtering and sorting](../../../../../../meta/filtering#query-sort)." + required: false + type: "string" + x-exportParamName: "Sort" + responses: + 200: + description: "If the path matches a file, then the raw contents of the file\ + \ are\nreturned. If the `format=meta` query parameter is provided,\n\ + a json document containing the file's meta data is\nreturned. If the\ + \ `format=rendered` query parameter is provided,\nthe contents of the\ + \ file in HTML-formated rendered markup is returned.\nIf the path matches\ + \ a directory, then a paginated\nlist of file and directory entries is\ + \ returned (if the\n`format=meta` query parameter was provided, then the\ + \ json document\ncontaining the directory's meta data is returned.)\n" + schema: + $ref: "#/definitions/paginated_treeentries" + 404: + description: "If the path or commit in the URL does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /snippets: + get: + tags: + - "snippets" + description: "Returns all snippets. Like pull requests, repositories and teams,\ + \ the\nfull set of snippets is defined by what the current user has access\ + \ to.\n\nThis includes all snippets owned by the current user, but also all\ + \ snippets\nowned by any of the teams the user is a member of, or snippets\ + \ by other\nusers that the current user is either watching or has collaborated\ + \ on (for\ninstance by commenting on it).\n\nTo limit the set of returned\ + \ snippets, apply the\n`?role=[owner|contributor|member]` query parameter\ + \ where the roles are\ndefined as follows:\n\n* `owner`: all snippets owned\ + \ by the current user\n* `contributor`: all snippets owned by, or watched\ + \ by the current user\n* `member`: owned by the user, their teams, or watched\ + \ by the current user\n\nWhen no role is specified, all public snippets are\ + \ returned, as well as all\nprivately owned snippets watched or commented\ + \ on.\n\nThe returned response is a normal paginated JSON list. This endpoint\n\ + only supports `application/json` responses and no\n`multipart/form-data` or\ + \ `multipart/related`. As a result, it is not\npossible to include the file\ + \ contents." + parameters: + - name: "role" + in: "query" + description: "Filter down the result based on the authenticated user's role\ + \ (`owner`, `contributor`, or `member`)." + required: false + type: "string" + enum: + - "owner" + - "contributor" + - "member" + x-exportParamName: "Role" + responses: + 200: + description: "A paginated list of snippets." + schema: + $ref: "#/definitions/paginated_snippets" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + post: + tags: + - "snippets" + description: "Creates a new snippet under the authenticated user's account.\n\ + \nSnippets can contain multiple files. Both text and binary files are\nsupported.\n\ + \nThe simplest way to create a new snippet from a local file:\n\n $ curl\ + \ -u username:password -X POST https://api.bitbucket.org/2.0/snippets \ + \ -F file=@image.png\n\nCreating snippets through curl has a few\ + \ limitations and so let's look\nat a more complicated scenario.\n\nSnippets\ + \ are created with a multipart POST. Both `multipart/form-data`\nand `multipart/related`\ + \ are supported. Both allow the creation of\nsnippets with both meta data\ + \ (title, etc), as well as multiple text\nand binary files.\n\nThe main difference\ + \ is that `multipart/related` can use rich encoding\nfor the meta data (currently\ + \ JSON).\n\n\nmultipart/related (RFC-2387)\n----------------------------\n\ + \nThis is the most advanced and efficient way to create a paste.\n\n POST\ + \ /2.0/snippets/evzijst HTTP/1.1\n Content-Length: 1188\n Content-Type:\ + \ multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\"\ + \n MIME-Version: 1.0\n\n --===============1438169132528273974==\n \ + \ Content-Type: application/json; charset=\"utf-8\"\n MIME-Version: 1.0\n\ + \ Content-ID: snippet\n\n {\n \"title\": \"My snippet\",\n \ + \ \"is_private\": true,\n \"scm\": \"hg\",\n \"files\": {\n \ + \ \"foo.txt\": {},\n \"image.png\": {}\n }\n }\n\n\ + \ --===============1438169132528273974==\n Content-Type: text/plain;\ + \ charset=\"us-ascii\"\n MIME-Version: 1.0\n Content-Transfer-Encoding:\ + \ 7bit\n Content-ID: \"foo.txt\"\n Content-Disposition: attachment;\ + \ filename=\"foo.txt\"\n\n foo\n\n --===============1438169132528273974==\n\ + \ Content-Type: image/png\n MIME-Version: 1.0\n Content-Transfer-Encoding:\ + \ base64\n Content-ID: \"image.png\"\n Content-Disposition: attachment;\ + \ filename=\"image.png\"\n\n iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m\n\ + \ TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB\n\ + \ cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5\n\ + \ EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ\n\ + \ 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN\n\ + \ AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg==\n --===============1438169132528273974==--\n\ + \nThe request contains multiple parts and is structured as follows.\n\nThe\ + \ first part is the JSON document that describes the snippet's\nproperties\ + \ or meta data. It either has to be the first part, or the\nrequest's `Content-Type`\ + \ header must contain the `start` parameter to\npoint to it.\n\nThe remaining\ + \ parts are the files of which there can be zero or more.\nEach file part\ + \ should contain the `Content-ID` MIME header through\nwhich the JSON meta\ + \ data's `files` element addresses it. The value\nshould be the name of the\ + \ file.\n\n`Content-Disposition` is an optional MIME header. The header's\n\ + optional `filename` parameter can be used to specify the file name\nthat Bitbucket\ + \ should use when writing the file to disk. When present,\n`filename` takes\ + \ precedence over the value of `Content-ID`.\n\nWhen the JSON body omits the\ + \ `files` element, the remaining parts are\nnot ignored. Instead, each file\ + \ is added to the new snippet as if its\nname was explicitly linked (the use\ + \ of the `files` elements is\nmandatory for some operations like deleting\ + \ or renaming files).\n\n\nmultipart/form-data\n-------------------\n\nThe\ + \ use of JSON for the snippet's meta data is optional. Meta data can\nalso\ + \ be supplied as regular form fields in a more conventional\n`multipart/form-data`\ + \ request:\n\n $ curl -X POST -u credentials https://api.bitbucket.org/2.0/snippets\ + \ -F title=\"My snippet\" -F file=@foo.txt -F\ + \ file=@image.png\n\n POST /2.0/snippets HTTP/1.1\n Content-Length:\ + \ 951\n Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f\n\ + \n ------------------------------63a4b224c59f\n Content-Disposition:\ + \ form-data; name=\"file\"; filename=\"foo.txt\"\n Content-Type: text/plain\n\ + \n foo\n\n ------------------------------63a4b224c59f\n Content-Disposition:\ + \ form-data; name=\"file\"; filename=\"image.png\"\n Content-Type: application/octet-stream\n\ + \n ?PNG\n\n IHDR?1??I.....\n ------------------------------63a4b224c59f\n\ + \ Content-Disposition: form-data; name=\"title\"\n\n My snippet\n \ + \ ------------------------------63a4b224c59f--\n\nHere the meta data properties\ + \ are included as flat, top-level form\nfields. The file attachments use the\ + \ `file` field name. To attach\nmultiple files, simply repeat the field.\n\ + \nThe advantage of `multipart/form-data` over `multipart/related` is\nthat\ + \ it can be easier to build clients.\n\nEssentially all properties are optional,\ + \ `title` and `files` included.\n\n\nSharing and Visibility\n----------------------\n\ + \nSnippets can be either public (visible to anyone on Bitbucket, as well\n\ + as anonymous users), or private (visible only to the owner, creator\nand members\ + \ of the team in case the snippet is owned by a team). This\nis controlled\ + \ through the snippet's `is_private` element:\n\n* **is_private=false** --\ + \ everyone, including anonymous users can view\n the snippet\n* **is_private=true**\ + \ -- only the owner and team members (for team\n snippets) can view it\n\n\ + To create the snippet under a team account, just append the team name\nto\ + \ the URL (see `/2.0/snippets/{username}`)." + parameters: + - in: "body" + name: "_body" + description: "The new snippet object." + required: true + schema: + $ref: "#/definitions/snippet" + x-exportParamName: "Body" + responses: + 201: + description: "The newly created snippet object." + schema: + $ref: "#/definitions/snippet" + headers: + Location: + type: "string" + description: "The URL of the newly created snippet." + 401: + description: "If the request was not authenticated" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid}: + get: + tags: + - "pipelines" + description: "Retrieve a repository level known host." + operationId: "getRepositoryPipelineKnownHost" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "known_host_uuid" + in: "path" + description: "The UUID of the known host to retrieve." + required: true + type: "string" + x-exportParamName: "KnownHostUuid" + responses: + 200: + description: "The known host." + schema: + $ref: "#/definitions/pipeline_known_host" + 404: + description: "The account, repository or known host with the specified UUID\ + \ was not found." + schema: + $ref: "#/definitions/error" + put: + tags: + - "pipelines" + description: "Update a repository level known host." + operationId: "updateRepositoryPipelineKnownHost" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "known_host_uuid" + in: "path" + description: "The UUID of the known host to update." + required: true + type: "string" + x-exportParamName: "KnownHostUuid" + - in: "body" + name: "_body" + description: "The updated known host." + required: true + schema: + $ref: "#/definitions/pipeline_known_host" + x-exportParamName: "Body" + responses: + 200: + description: "The known host was updated." + schema: + $ref: "#/definitions/pipeline_known_host" + 404: + description: "The account, repository or known host with the given UUID\ + \ was not found." + schema: + $ref: "#/definitions/error" + delete: + tags: + - "pipelines" + description: "Delete a repository level known host." + operationId: "deleteRepositoryPipelineKnownHost" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "known_host_uuid" + in: "path" + description: "The UUID of the known host to delete." + required: true + type: "string" + x-exportParamName: "KnownHostUuid" + responses: + 204: + description: "The known host was deleted." + 404: + description: "The account, repository or known host with given UUID was\ + \ not found." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}: + get: + tags: + - "pullrequests" + description: "Returns the specified pull request." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the account,\n\ + surrounded by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pull_request_id" + in: "path" + description: "The id of the pull request.\n" + required: true + type: "integer" + x-exportParamName: "PullRequestId" + responses: + 200: + description: "The pull request object" + schema: + $ref: "#/definitions/pullrequest" + 401: + description: "If the repository is private and the request was not authenticated." + 404: + description: "If the repository or pull request does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest" + - basic: [] + - api_key: [] + put: + tags: + - "pullrequests" + description: "Mutates the specified pull request.\n\nThis can be used to change\ + \ the pull request's branches or description.\n\nOnly open pull requests can\ + \ be mutated." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pull_request_id" + in: "path" + description: "The id of the open pull request.\n" + required: true + type: "integer" + x-exportParamName: "PullRequestId" + - in: "body" + name: "_body" + description: "The pull request that is to be updated." + required: false + schema: + $ref: "#/definitions/pullrequest" + x-exportParamName: "Body" + responses: + 200: + description: "The updated pull request" + schema: + $ref: "#/definitions/pullrequest" + 400: + description: "If the input document was invalid." + schema: + $ref: "#/definitions/error" + 401: + description: "If the request was not authenticated." + schema: + $ref: "#/definitions/error" + 404: + description: "If the repository or pull request id does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/comments: + get: + tags: + - "pullrequests" + description: "Returns a paginated list of the pull request's comments.\n\nThis\ + \ includes both global, inline comments and replies.\n\nThe default sorting\ + \ is oldest to newest and can be overridden with\nthe `sort` query parameter.\n\ + \nThis endpoint also supports filtering and sorting of the results. See\n\ + [filtering and sorting](../../../../../../meta/filtering) for more\ndetails." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the account,\n\ + surrounded by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pull_request_id" + in: "path" + description: "The id of the pull request.\n" + required: true + type: "integer" + x-exportParamName: "PullRequestId" + responses: + 200: + description: "A paginated list of comments made on the given pull request,\ + \ in reverse chronological order." + schema: + $ref: "#/definitions/paginated_pullrequest_comments" + 403: + description: "If the authenticated user does not have access to the pull\ + \ request." + schema: + $ref: "#/definitions/error" + 404: + description: "If the pull request does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest" + - basic: [] + - api_key: [] + /users/{username}/search/code: + get: + parameters: [] + responses: + 200: + schema: + $ref: "#/definitions/search_result" + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/decline: + post: + tags: + - "pullrequests" + description: "Declines the pull request." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "pull_request_id" + in: "path" + required: true + type: "string" + x-exportParamName: "PullRequestId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The pull request object." + schema: + $ref: "#/definitions/pullrequest" + security: + - oauth2: + - "pullrequest:write" + - basic: [] + - api_key: [] + /user/emails: + get: + tags: + - "users" + description: "Returns all the authenticated user's email addresses. Both\nconfirmed\ + \ and unconfirmed." + parameters: [] + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "email" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pullrequests: + get: + tags: + - "pullrequests" + description: "Returns a paginated list of all pull requests on the specified\n\ + repository. By default only open pull requests are returned. This can\nbe\ + \ controlled using the `state` query parameter. To retrieve pull\nrequests\ + \ that are in one of multiple states, repeat the `state`\nparameter for each\ + \ individual state.\n\nThis endpoint also supports filtering and sorting of\ + \ the results. See\n[filtering and sorting](../../../../meta/filtering) for\ + \ more details." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "state" + in: "query" + description: "Only return pull requests that are in this state. This parameter\ + \ can be repeated." + required: false + type: "string" + enum: + - "MERGED" + - "SUPERSEDED" + - "OPEN" + - "DECLINED" + x-exportParamName: "State" + responses: + 200: + description: "All pull requests on the specified repository." + schema: + $ref: "#/definitions/paginated_pullrequests" + 401: + description: "If the repository is private and the request was not authenticated." + 404: + description: "If the specified repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest" + - basic: [] + - api_key: [] + post: + tags: + - "pullrequests" + description: "Creates a new pull request." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The new pull request.\n\nThe request URL you POST to becomes\ + \ the destination repository URL. For this reason, you must specify an explicit\ + \ source repository in the request object if you want to pull from a different\ + \ repository (fork).\n\nSince not all elements are required or even mutable,\ + \ you only need to include the elements you want to initialize, such as\ + \ the source branch and the title." + required: false + schema: + $ref: "#/definitions/pullrequest" + x-exportParamName: "Body" + responses: + 201: + description: "The newly created pull request." + schema: + $ref: "#/definitions/pullrequest" + headers: + Location: + type: "string" + description: "The URL of new newly created pull request." + 400: + description: "If the input document was invalid, or if the caller lacks\ + \ the privilege to create repositories under the targeted account." + schema: + $ref: "#/definitions/error" + 401: + description: "If the request was not authenticated." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/commits: + get: + tags: + - "commits" + description: "These are the repository's commits. They are paginated and returned\n\ + in reverse chronological order, similar to the output of `git log` and\n`hg\ + \ log`. Like these tools, the DAG can be filtered.\n\n## GET /repositories/{username}/{repo_slug}/commits/\n\ + \nReturns all commits in the repo in topological order (newest commit\nfirst).\ + \ All branches and tags are included (similar to\n`git log --all` and `hg\ + \ log`).\n\n## GET /repositories/{username}/{repo_slug}/commits/master\n\n\ + Returns all commits on rev `master` (similar to `git log master`,\n`hg log\ + \ master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/dev?exclude=master\n\ + \nReturns all commits on ref `dev`, except those that are reachable on\n`master`\ + \ (similar to `git log dev ^master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/?exclude=master\n\ + \nReturns all commits in the repo that are not on master\n(similar to `git\ + \ log --all ^master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/?include=foo&include=bar&exclude=fu&exclude=fubar\n\ + \nReturns all commits that are on refs `foo` or `bar`, but not on `fu` or\n\ + `fubar` (similar to `git log foo bar ^fu ^fubar`).\n\nBecause the response\ + \ could include a very large number of commits, it\nis paginated. Follow the\ + \ 'next' link in the response to navigate to the\nnext page of commits. As\ + \ with other paginated resources, do not\nconstruct your own links.\n\nWhen\ + \ the include and exclude parameters are more than can fit in a\nquery string,\ + \ clients can use a `x-www-form-urlencoded` POST instead." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + post: + tags: + - "commits" + description: "Identical to `GET /repositories/{username}/{repo_slug}/commits`,\n\ + except that POST allows clients to place the include and exclude\nparameters\ + \ in the request body to avoid URL length issues.\n\n**Note that this resource\ + \ does NOT support new commit creation.**" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/commit/{node}/statuses: + get: + tags: + - "repositories" + - "commitstatuses" + description: "Returns all statuses (e.g. build results) for a specific commit." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "node" + in: "path" + description: "The commit's SHA1" + required: true + type: "string" + x-exportParamName: "Node" + responses: + 200: + description: "A paginated list of all commit statuses for this commit." + schema: + $ref: "#/definitions/paginated_commitstatuses" + 401: + description: "If the repository is private and the request was not authenticated." + 404: + description: "If the repository or commit does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/commit/{sha}/comments: + get: + tags: + - "commits" + description: "Returns the commit's comments.\n\nThis includes both global and\ + \ inline comments.\n\nThe default sorting is oldest to newest and can be overridden\ + \ with\nthe `sort` query parameter." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "sha" + in: "path" + required: true + type: "string" + x-exportParamName: "Sha" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/commit/{revision}: + get: + tags: + - "commits" + description: "Returns the specified commit." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "revision" + in: "path" + description: "The commit's SHA1." + required: true + type: "string" + x-exportParamName: "Revision" + responses: + 200: + description: "The commit object" + schema: + $ref: "#/definitions/commit" + 404: + description: "If the specified commit or repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /snippets/{username}: + get: + tags: + - "snippets" + description: "Identical to `/snippets`, except that the result is further filtered\n\ + by the snippet owner and only those that are owned by `{username}` are\nreturned." + parameters: + - name: "role" + in: "query" + description: "Filter down the result based on the authenticated user's role\ + \ (`owner`, `contributor`, or `member`)." + required: false + type: "string" + enum: + - "owner" + - "contributor" + - "member" + x-exportParamName: "Role" + - name: "username" + in: "path" + description: "Limits the result to snippets owned by this user." + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "A paginated list of snippets." + schema: + $ref: "#/definitions/paginated_snippets" + 404: + description: "If the user does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + post: + tags: + - "snippets" + description: "Identical to `/snippets`, except that the new snippet will be\n\ + created under the account specified in the path parameter `{username}`." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - in: "body" + name: "_body" + description: "The new snippet object." + required: true + schema: + $ref: "#/definitions/snippet" + x-exportParamName: "Body" + responses: + 201: + description: "The newly created snippet object." + schema: + $ref: "#/definitions/snippet" + headers: + Location: + type: "string" + description: "The URL of the newly created snippet." + 401: + description: "If the request was not authenticated" + schema: + $ref: "#/definitions/error" + 403: + description: "If the authenticated user does not have permission to create\ + \ snippets under the specified account." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/issues/{issue_id}/watch: + get: + tags: + - "issue_tracker" + description: "Indicated whether or not the authenticated user is watching this\n\ + issue." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue's id" + required: true + type: "integer" + x-exportParamName: "IssueId" + responses: + 204: + description: "If the authenticated user is watching this issue." + schema: + $ref: "#/definitions/error" + 401: + description: "When the request wasn't authenticated." + schema: + $ref: "#/definitions/error" + 404: + description: "If the authenticated user is not watching this issue, or when\ + \ the repo does not exist, or does not have an issue tracker." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - "account" + - basic: [] + - api_key: [] + put: + tags: + - "issue_tracker" + description: "Start watching this issue.\n\nTo start watching this issue, do\ + \ an empty PUT. The 204 status code\nindicates that the operation was successful." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue's id" + required: true + type: "integer" + x-exportParamName: "IssueId" + responses: + 204: + description: "Indicates that the authenticated user successfully started\ + \ watching this issue." + schema: + $ref: "#/definitions/error" + 401: + description: "When the request wasn't authenticated." + schema: + $ref: "#/definitions/error" + 404: + description: "If the authenticated user is not watching this issue, or when\ + \ the repo does not exist, or does not have an issue tracker." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - "account:write" + - basic: [] + - api_key: [] + delete: + tags: + - "issue_tracker" + description: "Stop watching this issue." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue's id" + required: true + type: "integer" + x-exportParamName: "IssueId" + responses: + 204: + description: "Indicates that the authenticated user successfully stopped\ + \ watching this issue." + schema: + $ref: "#/definitions/error" + 401: + description: "When the request wasn't authenticated." + schema: + $ref: "#/definitions/error" + 404: + description: "If the issue or the repo does not exist, or the repository\ + \ does not have an issue tracker." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue:write" + - "account:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/milestones/{milestone_id}: + get: + tags: + - "issue_tracker" + description: "Returns the specified issue tracker milestone object." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "milestone_id" + in: "path" + description: "The milestone's id" + required: true + type: "integer" + x-exportParamName: "MilestoneId" + responses: + 200: + description: "The specified milestone object." + schema: + $ref: "#/definitions/milestone" + 404: + description: "If the specified repository or milestone does not exist, or\ + \ if the repository doesn't have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + /snippets/{username}/{encoded_id}/commits/{revision}: + get: + tags: + - "snippets" + description: "" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + required: true + type: "string" + x-exportParamName: "EncodedId" + - name: "revision" + in: "path" + required: true + type: "string" + x-exportParamName: "Revision" + responses: + 200: + description: "The specified snippet commit." + schema: + $ref: "#/definitions/snippet_commit" + 403: + description: "If the authenticated user does not have access to the snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the commit or the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + /teams: + get: + tags: + - "teams" + description: "Returns all the teams that the authenticated user is associated\n\ + with." + parameters: + - name: "role" + in: "query" + description: "\nFilters the teams based on the authenticated user's role on\ + \ each team.\n\n* **member**: returns a list of all the teams which the\ + \ caller is a member of\n at least one team group or repository owned by\ + \ the team\n* **contributor**: returns a list of teams which the caller\ + \ has write access\n to at least one repository owned by the team\n* **admin**:\ + \ returns a list teams which the caller has team administrator access\n" + required: false + type: "string" + enum: + - "admin" + - "contributor" + - "member" + x-exportParamName: "Role" + responses: + 200: + description: "A paginated list of teams." + schema: + $ref: "#/definitions/paginated_teams" + 401: + description: "When the request wasn't authenticated." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "team" + - basic: [] + - api_key: [] + /user: + get: + tags: + - "users" + description: "Returns the currently logged in user." + parameters: [] + responses: + 200: + description: "The current user." + schema: + $ref: "#/definitions/user" + 401: + description: "When the request wasn't authenticated." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "account" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/commits/{revision}: + get: + tags: + - "commits" + description: "These are the repository's commits. They are paginated and returned\n\ + in reverse chronological order, similar to the output of `git log` and\n`hg\ + \ log`. Like these tools, the DAG can be filtered.\n\n## GET /repositories/{username}/{repo_slug}/commits/\n\ + \nReturns all commits in the repo in topological order (newest commit\nfirst).\ + \ All branches and tags are included (similar to\n`git log --all` and `hg\ + \ log`).\n\n## GET /repositories/{username}/{repo_slug}/commits/master\n\n\ + Returns all commits on rev `master` (similar to `git log master`,\n`hg log\ + \ master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/dev?exclude=master\n\ + \nReturns all commits on ref `dev`, except those that are reachable on\n`master`\ + \ (similar to `git log dev ^master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/?exclude=master\n\ + \nReturns all commits in the repo that are not on master\n(similar to `git\ + \ log --all ^master`).\n\n## GET /repositories/{username}/{repo_slug}/commits/?include=foo&include=bar&exclude=fu&exclude=fubar\n\ + \nReturns all commits that are on refs `foo` or `bar`, but not on `fu` or\n\ + `fubar` (similar to `git log foo bar ^fu ^fubar`).\n\nBecause the response\ + \ could include a very large number of commits, it\nis paginated. Follow the\ + \ 'next' link in the response to navigate to the\nnext page of commits. As\ + \ with other paginated resources, do not\nconstruct your own links.\n\nWhen\ + \ the include and exclude parameters are more than can fit in a\nquery string,\ + \ clients can use a `x-www-form-urlencoded` POST instead." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "revision" + in: "path" + required: true + type: "string" + x-exportParamName: "Revision" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + post: + tags: + - "commits" + description: "Identical to `GET /repositories/{username}/{repo_slug}/commits`,\n\ + except that POST allows clients to place the include and exclude\nparameters\ + \ in the request body to avoid URL length issues.\n\n**Note that this resource\ + \ does NOT support new commit creation.**" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "revision" + in: "path" + required: true + type: "string" + x-exportParamName: "Revision" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /snippets/{username}/{encoded_id}/comments: + get: + tags: + - "snippets" + description: "Used to retrieve a paginated list of all comments for a specific\n\ + snippet.\n\nThis resource works identical to commit and pull request comments.\n\ + \nThe default sorting is oldest to newest and can be overridden with\nthe\ + \ `sort` query parameter." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 200: + description: "A paginated list of snippet comments, ordered by creation\ + \ date." + schema: + $ref: "#/definitions/paginated_snippet_comments" + 403: + description: "If the authenticated user does not have access to the snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + post: + tags: + - "snippets" + description: "Creates a new comment.\n\nThe only required field in the body\ + \ is `content.raw`.\n\nTo create a threaded reply to an existing comment,\ + \ include `parent.id`." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + required: true + type: "string" + x-exportParamName: "EncodedId" + - in: "body" + name: "_body" + description: "The contents of the new comment." + required: true + schema: + $ref: "#/definitions/snippet" + x-exportParamName: "Body" + responses: + 201: + description: "The newly created comment." + schema: + $ref: "#/definitions/snippet" + headers: + Location: + type: "string" + description: "The URL of the new comment" + 403: + description: "If the authenticated user does not have access to the snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/activity: + get: + tags: + - "pullrequests" + description: "Returns a paginated list of the pull request's activity log.\n\ + \nThis includes comments that were made by the reviewers, updates and\napprovals." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pull_request_id" + in: "path" + description: "The id of the pull request.\n" + required: true + type: "integer" + x-exportParamName: "PullRequestId" + responses: + 200: + description: "The pull request activity log" + 401: + description: "If the repository is private and the request was not authenticated." + 404: + description: "If the specified repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest" + - basic: [] + - api_key: [] + /repositories/{username}: + get: + tags: + - "repositories" + description: "Returns a paginated list of all repositories owned by the specified\n\ + account or UUID.\n\nThe result can be narrowed down based on the authenticated\ + \ user's role.\n\nE.g. with `?role=contributor`, only those repositories that\ + \ the\nauthenticated user has write access to are returned (this includes\ + \ any\nrepo the user is an admin on, as that implies write access).\n\nThis\ + \ endpoint also supports filtering and sorting of the results. See\n[filtering\ + \ and sorting](../../meta/filtering) for more details." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "role" + in: "query" + description: "\nFilters the result based on the authenticated user's role\ + \ on each repository.\n\n* **member**: returns repositories to which the\ + \ user has explicit read access\n* **contributor**: returns repositories\ + \ to which the user has explicit write access\n* **admin**: returns repositories\ + \ to which the user has explicit administrator access\n* **owner**: returns\ + \ all repositories owned by the current user\n" + required: false + type: "string" + enum: + - "admin" + - "contributor" + - "member" + - "owner" + x-exportParamName: "Role" + responses: + 200: + description: "The repositories owned by the specified account." + schema: + $ref: "#/definitions/paginated_repositories" + 404: + description: "If the specified account does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/merge: + post: + tags: + - "pullrequests" + description: "Merges the pull request." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "pull_request_id" + in: "path" + required: true + type: "string" + x-exportParamName: "PullRequestId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + required: false + schema: + $ref: "#/definitions/pullrequest_merge_parameters" + x-exportParamName: "Body" + responses: + 200: + description: "The pull request object." + schema: + $ref: "#/definitions/pullrequest" + security: + - oauth2: + - "pullrequest:write" + - basic: [] + - api_key: [] + /users/{username}/ssh-keys/: + get: + tags: + - "ssh" + description: "Returns a specific SSH public key belonging to a user.\n\nExample:\n\ + ```\n$ curl https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/{fbe4bbab-f6f7-4dde-956b-5c58323c54b3}\n\ + \n{\n \"comment\": \"user@myhost\",\n \"created_on\": \"2018-03-14T13:17:05.196003+00:00\"\ + ,\n \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\"\ + ,\n \"label\": \"\",\n \"last_used\": \"2018-03-20T13:18:05.196003+00:00\"\ + ,\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\"\ + \n }\n },\n \"owner\": {\n \"display_name\": \"Mark Adams\"\ + ,\n \"links\": {\n \"avatar\": {\n \"href\"\ + : \"https://bitbucket.org/account/markadams-atl/avatar/32/\"\n \ + \ },\n \"html\": {\n \"href\": \"https://bitbucket.org/markadams-atl/\"\ + \n },\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\"\ + \n }\n },\n \"type\": \"user\",\n \"username\"\ + : \"markadams-atl\",\n \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\"\ + \n },\n \"type\": \"ssh_key\",\n \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\"\ + \n}\n```" + parameters: + - name: "username" + in: "path" + description: "The account's username or UUID." + required: true + type: "string" + x-exportParamName: "Username" + - name: "key_id" + in: "path" + description: "The SSH key's UUID value." + required: true + type: "string" + x-exportParamName: "KeyId" + responses: + 200: + description: "The specific SSH key matching the user and UUID" + schema: + $ref: "#/definitions/ssh_account_key" + 403: + description: "If the specified user or key is not accessible to the current\ + \ user" + 404: + description: "If the specified user or key does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "account" + - basic: [] + - api_key: [] + put: + tags: + - "ssh" + description: "Updates a specific SSH public key on a user's account\n\nNote:\ + \ Only the 'comment' field can be updated using this API. To modify the key\ + \ or comment values, you must delete and add the key again.\n\nExample:\n\ + ```\n$ curl -X PUT -H \"Content-Type: application/json\" -d '{\"label\": \"\ + Work key\"}' https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a}\n\ + \n{\n \"comment\": \"\",\n \"created_on\": \"2018-03-14T13:17:05.196003+00:00\"\ + ,\n \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\"\ + ,\n \"label\": \"Work key\",\n \"last_used\": \"2018-03-20T13:18:05.196003+00:00\"\ + ,\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\"\ + \n }\n },\n \"owner\": {\n \"display_name\": \"Mark Adams\"\ + ,\n \"links\": {\n \"avatar\": {\n \"href\"\ + : \"https://bitbucket.org/account/markadams-atl/avatar/32/\"\n \ + \ },\n \"html\": {\n \"href\": \"https://bitbucket.org/markadams-atl/\"\ + \n },\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\"\ + \n }\n },\n \"type\": \"user\",\n \"username\"\ + : \"markadams-atl\",\n \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\"\ + \n },\n \"type\": \"ssh_key\",\n \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\"\ + \n}\n```" + parameters: + - name: "username" + in: "path" + description: "The account's username or UUID." + required: true + type: "string" + x-exportParamName: "Username" + - name: "key_id" + in: "path" + description: "The SSH key's UUID value." + required: true + type: "string" + x-exportParamName: "KeyId" + - in: "body" + name: "_body" + description: "The updated SSH key object" + required: false + schema: + $ref: "#/definitions/ssh_account_key" + x-exportParamName: "Body" + responses: + 200: + description: "The newly updated SSH key." + schema: + $ref: "#/definitions/ssh_account_key" + 400: + description: "If the submitted key or related value is invalid" + schema: + $ref: "#/definitions/error" + 403: + description: "If the current user does not have permission to add a key\ + \ for the specified user" + 404: + description: "If the specified user does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "account:write" + - basic: [] + - api_key: [] + delete: + tags: + - "ssh" + description: "Deletes a specific SSH public key from a user's account\n\nExample:\n\ + ```\n$ curl -X DELETE https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a}\n\ + ```" + parameters: + - name: "username" + in: "path" + description: "The account's username or UUID." + required: true + type: "string" + x-exportParamName: "Username" + - name: "key_id" + in: "path" + description: "The SSH key's UUID value." + required: true + type: "string" + x-exportParamName: "KeyId" + responses: + 204: + description: "The key has been deleted" + 403: + description: "If the current user does not have permission to add a key\ + \ for the specified user" + 404: + description: "If the specified user does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "account:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines_config/ssh/key_pair: + get: + tags: + - "pipelines" + description: "Retrieve the repository SSH key pair excluding the SSH private\ + \ key. The private key is a write only field and will never be exposed in\ + \ the logs or the REST API." + operationId: "getRepositoryPipelineSshKeyPair" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The SSH key pair." + schema: + $ref: "#/definitions/pipeline_ssh_key_pair" + 404: + description: "The account, repository or SSH key pair was not found." + schema: + $ref: "#/definitions/error" + put: + tags: + - "pipelines" + description: "Create or update the repository SSH key pair. The private key\ + \ will be set as a default SSH identity in your build container." + operationId: "updateRepositoryPipelineKeyPair" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The created or updated SSH key pair." + required: true + schema: + $ref: "#/definitions/pipeline_ssh_key_pair" + x-exportParamName: "Body" + responses: + 200: + description: "The SSH key pair was created or updated." + schema: + $ref: "#/definitions/pipeline_ssh_key_pair" + 404: + description: "The account, repository or SSH key pair was not found." + schema: + $ref: "#/definitions/error" + delete: + tags: + - "pipelines" + description: "Delete the repository SSH key pair." + operationId: "deleteRepositoryPipelineKeyPair" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 204: + description: "The SSH key pair was deleted." + 404: + description: "The account, repository or SSH key pair was not found." + schema: + $ref: "#/definitions/error" + /users/{username}/ssh-keys: + get: + tags: + - "ssh" + description: "Returns a paginated list of the user's SSH public keys.\n\nExample:\n\ + \n```\n$ curl https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys\n\ + {\n \"page\": 1,\n \"pagelen\": 10,\n \"size\": 1,\n \"values\"\ + : [\n {\n \"comment\": \"user@myhost\",\n \"\ + created_on\": \"2018-03-14T13:17:05.196003+00:00\",\n \"key\":\ + \ \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\"\ + ,\n \"label\": \"\",\n \"last_used\": \"2018-03-20T13:18:05.196003+00:00\"\ + ,\n \"links\": {\n \"self\": {\n \ + \ \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\"\ + \n }\n },\n \"owner\": {\n \ + \ \"display_name\": \"Mark Adams\",\n \"links\": {\n \ + \ \"avatar\": {\n \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\"\ + \n },\n \"html\": {\n \ + \ \"href\": \"https://bitbucket.org/markadams-atl/\"\n \ + \ },\n \"self\": {\n \"\ + href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\"\n \ + \ }\n },\n \"type\": \"user\",\n \ + \ \"username\": \"markadams-atl\",\n \"uuid\"\ + : \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\"\n },\n \ + \ \"type\": \"ssh_key\",\n \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\"\ + \n }\n ]\n}\n```" + parameters: + - name: "username" + in: "path" + description: "The account's username or UUID." + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "A list of the SSH keys associated with the account." + schema: + $ref: "#/definitions/paginated_ssh_user_keys" + 403: + description: "If the specified user's keys are not accessible to the current\ + \ user" + 404: + description: "If the specified user does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "account" + - basic: [] + - api_key: [] + post: + tags: + - "ssh" + description: "Adds a new SSH public key to the specified user account and returns\ + \ the resulting key.\n\nExample:\n```\n$ curl -X POST -H \"Content-Type: application/json\"\ + \ -d '{\"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\ + \ user@myhost\"}' https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys\n\ + \n{\n \"comment\": \"user@myhost\",\n \"created_on\": \"2018-03-14T13:17:05.196003+00:00\"\ + ,\n \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\"\ + ,\n \"label\": \"\",\n \"last_used\": \"2018-03-20T13:18:05.196003+00:00\"\ + ,\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\"\ + \n }\n },\n \"owner\": {\n \"display_name\": \"Mark Adams\"\ + ,\n \"links\": {\n \"avatar\": {\n \"href\"\ + : \"https://bitbucket.org/account/markadams-atl/avatar/32/\"\n \ + \ },\n \"html\": {\n \"href\": \"https://bitbucket.org/markadams-atl/\"\ + \n },\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\"\ + \n }\n },\n \"type\": \"user\",\n \"username\"\ + : \"markadams-atl\",\n \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\"\ + \n },\n \"type\": \"ssh_key\",\n \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\"\ + \n}\n```" + parameters: + - name: "username" + in: "path" + description: "The account's username or UUID." + required: true + type: "string" + x-exportParamName: "Username" + - in: "body" + name: "_body" + description: "The new SSH key object" + required: false + schema: + $ref: "#/definitions/ssh_account_key" + x-exportParamName: "Body" + responses: + 201: + description: "The newly created SSH key." + schema: + $ref: "#/definitions/ssh_account_key" + 400: + description: "If the submitted key or related value is invalid" + schema: + $ref: "#/definitions/error" + 403: + description: "If the current user does not have permission to add a key\ + \ for the specified user" + 404: + description: "If the specified user does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "account:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/issues/{issue_id}/changes/{change_id}: + get: + tags: + - "issue_tracker" + description: "Returns the specified issue change object.\n\nThis resource is\ + \ only available on repositories that have the issue\ntracker enabled." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "issue_id" + in: "path" + description: "The issue id" + required: true + type: "string" + x-exportParamName: "IssueId" + - name: "change_id" + in: "path" + description: "The issue change id" + required: true + type: "string" + x-exportParamName: "ChangeId" + responses: + 200: + description: "The specified issue change object." + schema: + $ref: "#/definitions/issue_change" + 404: + description: "If the specified repository or issue change does not exist,\ + \ or if the repository does not have the issue tracker enabled." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + /teams/{username}/followers: + get: + tags: + - "teams" + description: "Returns the list of accounts that are following this team." + parameters: + - name: "username" + in: "path" + description: "The team's username" + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "A paginated list of user objects." + schema: + $ref: "#/definitions/paginated_users" + 404: + description: "If no team exists for the specified name, or if the specified\ + \ account is a personal account, not a team account." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /snippets/{username}/{encoded_id}/{node_id}/files/{path}: + get: + tags: + - "snippets" + description: "Retrieves the raw contents of a specific file in the snippet.\ + \ The\n`Content-Disposition` header will be \"attachment\" to avoid issues\ + \ with\nmalevolent executable files.\n\nThe file's mime type is derived from\ + \ its filename and returned in the\n`Content-Type` header.\n\nNote that for\ + \ text files, no character encoding is included as part of\nthe content type." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "path" + in: "path" + required: true + type: "string" + x-exportParamName: "Path" + - name: "node_id" + in: "path" + required: true + type: "string" + x-exportParamName: "NodeId" + - name: "encoded_id" + in: "path" + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 200: + description: "Returns the contents of the specified file." + headers: + Content-Type: + type: "string" + description: "The mime type as derived from the filename" + Content-Disposition: + type: "string" + description: "attachment" + 403: + description: "If the authenticated user does not have access to the snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the file or snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/log: + get: + tags: + - "pipelines" + description: "Retrieve the log file for a given step of a pipeline.\n\nThis\ + \ endpoint supports (and encourages!) the use of [HTTP Range requests](https://tools.ietf.org/html/rfc7233)\ + \ to deal with potentially very large log files." + operationId: "getPipelineStepLogForRepository" + produces: + - "application/octet-stream" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pipeline_uuid" + in: "path" + description: "The UUID of the pipeline." + required: true + type: "string" + x-exportParamName: "PipelineUuid" + - name: "step_uuid" + in: "path" + description: "The UUID of the step." + required: true + type: "string" + x-exportParamName: "StepUuid" + responses: + 200: + description: "The raw log file for this pipeline step." + 304: + description: "The log has the same etag as the provided If-None-Match header." + schema: + $ref: "#/definitions/error" + 404: + description: "A pipeline with the given UUID does not exist, a step with\ + \ the given UUID does not exist in the pipeline or a log file does not\ + \ exist for the given step." + schema: + $ref: "#/definitions/error" + 416: + description: "The requested range does not exist for requests that specified\ + \ the [HTTP Range header](https://tools.ietf.org/html/rfc7233#section-3.1)." + schema: + $ref: "#/definitions/error" + /addon/linkers/{linker_key}: + get: + tags: + - "addon" + description: "" + parameters: + - name: "linker_key" + in: "path" + required: true + type: "string" + x-exportParamName: "LinkerKey" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/refs/tags: + get: + tags: + - "refs" + description: "" + parameters: + - name: "username" + in: "path" + description: "\nThe username for the owner of the repository. This can either\ + \ be the\n`username` of the owner or the `UUID` of the owner (surrounded\ + \ by\ncurly-braces (`{}`)). Owners can be users or teams.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "\nThe repo slug for the repository. This can either be the\ + \ `repo_slug` of\nthe repository or the `UUID` of the repository (surrounded\ + \ by\ncurly-braces (`{}`))\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + post: + tags: + - "refs" + description: "Creates a new tag in the specified repository.\n\nThe payload\ + \ of the POST should consist of a JSON document that\ncontains the name of\ + \ the tag and the target hash.\n\n```\n{\n \"name\" : \"new tag name\"\ + ,\n \"target\" : {\n \"hash\" : \"target commit hash\",\n }\n\ + }\n```\n\nThis endpoint does support using short hash prefixes for the commit\n\ + hash, but it may return a 400 response if the provided prefix is\nambiguous.\ + \ Using a full commit hash is the preferred approach." + parameters: + - name: "username" + in: "path" + description: "\nThe username for the owner of the repository. This can either\ + \ be the\n`username` of the owner or the `UUID` of the owner (surrounded\ + \ by\ncurly-braces (`{}`)). Owners can be users or teams.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "\nThe repo slug for the repository. This can either be the\ + \ `repo_slug` of\nthe repository or the `UUID` of the repository (surrounded\ + \ by\ncurly-braces (`{}`))\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + required: true + schema: + $ref: "#/definitions/tag" + x-exportParamName: "Body" + responses: + 201: + description: "The newly created tag." + schema: + $ref: "#/definitions/tag" + 400: + description: "If the target hash is missing, ambiguous, or invalid, or if\ + \ the name is not provided." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/commit/{node}/approve: + post: + tags: + - "commits" + description: "Approve the specified commit as the authenticated user.\n\nThis\ + \ operation is only available to users that have explicit access to\nthe repository.\ + \ In contrast, just the fact that a repository is\npublicly accessible to\ + \ users does not give them the ability to approve\ncommits." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "node" + in: "path" + description: "The commit's SHA1." + required: true + type: "string" + x-exportParamName: "Node" + responses: + 200: + description: "The `participant` object recording that the authenticated\ + \ user approved the commit." + schema: + $ref: "#/definitions/participant" + 404: + description: "If the specified commit, or the repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:write" + - basic: [] + - api_key: [] + delete: + tags: + - "commits" + description: "Redact the authenticated user's approval of the specified commit.\n\ + \nThis operation is only available to users that have explicit access to\n\ + the repository. In contrast, just the fact that a repository is\npublicly\ + \ accessible to users does not give them the ability to approve\ncommits." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "node" + in: "path" + description: "The commit's SHA1." + required: true + type: "string" + x-exportParamName: "Node" + responses: + 204: + description: "An empty response indicating the authenticated user's approval\ + \ has been withdrawn." + 404: + description: "If the specified commit, or the repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}/executions/: + get: + tags: + - "pipelines" + description: "Retrieve the executions of a given schedule." + operationId: "getRepositoryPipelineScheduleExecutions" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The list of executions of a schedule." + schema: + $ref: "#/definitions/paginated_pipeline_schedule_executions" + 404: + description: "The account or repository was not found." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/commits: + get: + tags: + - "pullrequests" + description: "Returns a paginated list of the pull request's commits.\n\nThese\ + \ are the commits that are being merged into the destination\nbranch when\ + \ the pull requests gets accepted." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "pull_request_id" + in: "path" + required: true + type: "string" + x-exportParamName: "PullRequestId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/src: + get: + tags: + - "source" + - "repositories" + description: "This endpoint redirects the client to the directory listing of\ + \ the\nroot directory on the main branch.\n\nThis is equivalent to directly\ + \ hitting\n[/2.0/repositories/{username}/{repo_slug}/src/{node}/{path}](src/%7Bnode%7D/%7Bpath%7D)\n\ + without having to know the name or SHA1 of the repo's main branch.\n\nTo create\ + \ new commits, [POST to this endpoint](#post)" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "format" + in: "query" + description: "Instead of returning the file's contents, return the (json)\ + \ meta data for it." + required: false + type: "string" + enum: + - "meta" + x-exportParamName: "Format" + responses: + 200: + description: "If the path matches a file, then the raw contents of the file\ + \ are\nreturned (unless the `format=meta` query parameter was provided,\n\ + in which case a json document containing the file's meta data is\nreturned).\ + \ If the path matches a directory, then a paginated\nlist of file and\ + \ directory entries is returned (if the\n`format=meta` query parameter\ + \ was provided, then the json document\ncontaining the directory's meta\ + \ data is returned).\n" + schema: + $ref: "#/definitions/paginated_treeentries" + 404: + description: "If the path or commit in the URL does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + post: + tags: + - "source" + - "repositories" + description: "This endpoint is used to create new commits in the repository\ + \ by\nuploading files.\n\nTo add a new file to a repository:\n\n```\n$ curl\ + \ https://api.bitbucket.org/2.0/repositories/username/slug/src \\\n -F\ + \ /repo/path/to/image.png=@image.png\n```\n\nThis will create a new commit\ + \ on top of the main branch, inheriting the\ncontents of the main branch,\ + \ but adding (or overwriting) the\n`image.png` file to the repository in the\ + \ `/repo/path/to` directory.\n\nThis endpoint accepts `multipart/form-data`\ + \ (as in the example above), as\nwell as `application/x-www-form-urlencoded`.\n\ + \n## multipart/form-data\n\nA `multipart/form-data` post contains a series\ + \ of \"form fields\" that\nidentify both the individual files that are being\ + \ uploaded, as well as\nadditional, optional meta data.\n\nFiles are uploaded\ + \ in file form fields (those that have a\n`Content-Disposition` parameter)\ + \ whose field names point to the remote\npath in the repository where the\ + \ file should be stored. Path field\nnames are always interpreted to be absolute\ + \ from the root of the\nrepository, regardless whether the client uses a leading\ + \ slash (as the\nabove `curl` example did).\n\nFile contents are treated as\ + \ bytes and are not decoded as text.\n\nThe commit message, as well as other\ + \ non-file meta data for the\nrequest, is sent along as normal form field\ + \ elements. Meta data fields\nshare the same namespace as the file objects.\ + \ For `multipart/form-data`\nbodies that should not lead to any ambiguity,\ + \ as the\n`Content-Disposition` header will contain the `filename` parameter\ + \ to\ndistinguish between a file named \"message\" and the commit message\ + \ field.\n\n## application/x-www-form-urlencoded\n\nIt is also possible to\ + \ upload new files using a simple\n`application/x-www-form-urlencoded` POST.\ + \ This can be convenient when\nuploading pure text files:\n\n```\n$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/\ + \ \\\n --data-urlencode \"/path/to/me.txt=Lorem ipsum.\" \\\n --data-urlencode\ + \ \"message=Initial commit\" \\\n --data-urlencode \"author=Erik van Zijst\ + \ \"\n```\n\nThere could be a field name clash if\ + \ a client were to upload a file\nnamed \"message\", as this filename clashes\ + \ with the meta data property\nfor the commit message. To avoid this and to\ + \ upload files whose names\nclash with the meta data properties, use a leading\ + \ slash for the files,\ne.g. `curl --data-urlencode \"/message=file contents\"\ + `.\n\nWhen an explicit slash is omitted for a file whose path matches that\ + \ of\na meta data parameter, then it is interpreted as meta data, not as a\n\ + file.\n\n## Executables and links\n\nWhile this API aims to facilitate the\ + \ most common use cases, it is\npossible to perform some more advanced operations\ + \ like creating a new\nsymlink in the repository, or creating an executable\ + \ file.\n\nFiles can be supplied with a `x-attributes` value in the\n`Content-Disposition`\ + \ header. For example, to upload an executable\nfile, as well as create a\ + \ symlink from `README.txt` to `README`:\n\n```\n--===============1438169132528273974==\n\ + Content-Type: text/plain; charset=\"us-ascii\"\nMIME-Version: 1.0\nContent-Transfer-Encoding:\ + \ 7bit\nContent-ID: \"bin/shutdown.sh\"\nContent-Disposition: attachment;\ + \ filename=\"shutdown.sh\"; x-attributes:\"executable\"\n\n#!/bin/sh\nhalt\n\ + \n--===============1438169132528273974==\nContent-Type: text/plain; charset=\"\ + us-ascii\"\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nContent-ID:\ + \ \"/README.txt\"\nContent-Disposition: attachment; filename=\"README.txt\"\ + ; x-attributes:\"link\"\n\nREADME\n--===============1438169132528273974==--\n\ + ```\n\nLinks are files that contain the target path and have\n`x-attributes:\"\ + link\"` set.\n\nWhen overwriting links with files, or vice versa, the newly\ + \ uploaded\nfile determines both the new contents, as well as the attributes.\ + \ That\nmeans uploading a file without specifying `x-attributes=\"link\"`\ + \ will\ncreate a regular file, even if the parent commit hosted a symlink\ + \ at\nthe same path.\n\nThe same applies to executables. When modifying an\ + \ existing executable\nfile, the form-data file element must include\n`x-attributes=\"\ + executable\"` in order to preserve the executable status\nof the file.\n\n\ + Note that this API does not support the creation or manipulation of\nsubrepos\ + \ / submodules." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "message" + in: "query" + description: "The commit message. When omitted, Bitbucket uses a canned string." + required: false + type: "string" + x-exportParamName: "Message" + - name: "author" + in: "query" + description: "\nThe raw string to be used as the new commit's author.\nThis\ + \ string follows the format\n`Erik van Zijst `.\n\ + \nWhen omitted, Bitbucket uses the authenticated user's\nfull/display name\ + \ and primary email address. Commits cannot\nbe created anonymously." + required: false + type: "string" + x-exportParamName: "Author" + - name: "parents" + in: "query" + description: "\nA comma-separated list of SHA1s of the commits that should\n\ + be the parents of the newly created commit.\n\nWhen omitted, the new commit\ + \ will inherit from and become\na child of the main branch's tip/HEAD commit.\n\ + \nWhen more than one SHA1 is provided, the first SHA1\nidentifies the commit\ + \ from which the content will be\ninherited.\n\nWhen more than 2 parents\ + \ are provided on a Mercurial repo,\na 400 is returned as Mercurial does\ + \ not support \"octopus\nmerges\"." + required: false + type: "string" + x-exportParamName: "Parents" + - name: "files" + in: "query" + description: "\nOptional field that declares the files that the request is\n\ + manipulating. When adding a new file to a repo, or when\noverwriting an\ + \ existing file, the client can just upload\nthe full contents of the file\ + \ in a normal form field and\nthe use of this `files` meta data field is\ + \ redundant.\nHowever, when the `files` field contains a file path that\n\ + does not have a corresponding, identically-named form\nfield, then Bitbucket\ + \ interprets that as the client wanting\nto replace the named file with\ + \ the null set and the file is\ndeleted instead.\n\nPaths in the repo that\ + \ are referenced in neither files nor\nan individual file field, remain\ + \ unchanged and carry over\nfrom the parent to the new commit.\n\nThis API\ + \ does not support renaming as an explicit feature.\nTo rename a file, simply\ + \ delete it and recreate it under\nthe new name in the same commit.\n" + required: false + type: "string" + x-exportParamName: "Files" + - name: "files" + in: "query" + description: "\nThe name of the branch that the new commit should be\ncreated\ + \ on. When omitted, the commit will be created on top\nof the main branch\ + \ and will become the main branch's new\nHEAD/tip.\n\nWhen a branch name\ + \ is provided that already exists in the\nrepo, then the commit will be\ + \ created on top of that\nbranch. In this case, if a parent SHA1 was also\ + \ provided,\nthen it is asserted that the parent is the branch's\ntip/HEAD\ + \ at the time the request is made. When this is not\nthe case, a 409 is\ + \ returned.\n\nThis API cannot be used to create new anonymous heads in\n\ + Mercurial repos.\n\nWhen a new branch name is specified (that does not already\n\ + exist in the repo), and no parent SHA1s are provided, then\nthe new commit\ + \ will inherit from the current main branch's\ntip/HEAD commit, but not\ + \ advance the main branch. The new\ncommit will be the new branch. When\ + \ the request also\nspecifies a parent SHA1, then the new commit and branch\n\ + are created directly on top of the parent commit,\nregardless of the state\ + \ of the main branch.\n\nWhen a branch name is not specified, but a parent\ + \ SHA1 is\nprovided, then Bitbucket asserts that it represents the\nmain\ + \ branch's current HEAD/tip, or a 409 is returned.\n\nWhen a branch name\ + \ is not specified and the repo is empty,\nthe new commit will become the\ + \ repo's root commit and will\nbe on the main branch.\n\nWhen a branch name\ + \ is specified and the repo is empty, the\nnew commit will become the repo's\ + \ root commit and also\ndefine the repo's main branch going forward.\n\n\ + This API cannot be used to create additional root commits\nin non-empty\ + \ repos.\n\nThe branch field cannot be repeated.\n\nAs a side effect, this\ + \ API can be used to create a new\nbranch without modifying any files, by\ + \ specifying a new\nbranch name in this field, together with parents, but\n\ + omitting the files fields, while not sending any files.\nThis will create\ + \ a new commit and branch with the same\ncontents as the first parent. The\ + \ diff of this commit\nagainst its first parent will be empty.\n" + required: false + type: "string" + x-exportParamName: "Files" + - name: "branch" + in: "query" + description: "\nThe name of the branch that the new commit should be\ncreated\ + \ on. When omitted, the commit will be created on top\nof the main branch\ + \ and will become the main branch's new\nhead.\n\nWhen a branch name is\ + \ provided that already exists in the\nrepo, then the commit will be created\ + \ on top of that\nbranch. In this case, *if* a parent SHA1 was also provided,\n\ + then it is asserted that the parent is the branch's\ntip/HEAD at the time\ + \ the request is made. When this is not\nthe case, a 409 is returned.\n\n\ + This API cannot be used to create new anonymous heads in\nMercurial repositories.\n\ + \nWhen a new branch name is specified (that does not already\nexist in the\ + \ repo), and no parent SHA1s are provided, then\nthe new commit will inherit\ + \ from the current main branch's\ntip/HEAD commit, but not advance the main\ + \ branch. The new\ncommit will be the new branch. When the request *also*\n\ + specifies a parent SHA1, then the new commit and branch\nare created directly\ + \ on top of the parent commit,\nregardless of the state of the main branch.\n\ + \nWhen a branch name is not specified, but a parent SHA1 is\nprovided, then\ + \ Bitbucket asserts that it represents the\nmain branch's current HEAD/tip,\ + \ or a 409 is returned.\n\nWhen a branch name is not specified and the repo\ + \ is empty,\nthe new commit will become the repo's root commit and will\n\ + be on the main branch.\n\nWhen a branch name is specified and the repo is\ + \ empty, the\nnew commit will become the repo's root commit and also\ndefine\ + \ the repo's main branch going forward.\n\nThis API cannot be used to create\ + \ additional root commits\nin non-empty repos.\n\nThe branch field cannot\ + \ be repeated.\n\nAs a side effect, this API can be used to create a new\n\ + branch without modifying any files, by specifying a new\nbranch name in\ + \ this field, together with `parents`, but\nomitting the `files` fields,\ + \ while not sending any files.\nThis will create a new commit and branch\ + \ with the same\ncontents as the first parent. The diff of this commit\n\ + against its first parent will be empty.\n" + required: false + type: "string" + x-exportParamName: "Branch" + responses: + 200: + description: "\n" + 404: + description: "If the repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:write" + - basic: [] + - api_key: [] + /snippets/{username}/{encoded_id}/{revision}/diff: + get: + tags: + - "snippets" + description: "Returns the diff of the specified commit against its first parent.\n\ + \nNote that this resource is different in functionality from the `patch`\n\ + resource.\n\nThe differences between a diff and a patch are:\n\n* patches\ + \ have a commit header with the username, message, etc\n* diffs support the\ + \ optional `path=foo/bar.py` query param to filter the\n diff to just that\ + \ one file diff (not supported for patches)\n* for a merge, the diff will\ + \ show the diff between the merge commit and\n its first parent (identical\ + \ to how PRs work), while patch returns a\n response containing separate\ + \ patches for each commit on the second\n parent's ancestry, up to the oldest\ + \ common ancestor (identical to\n its reachability).\n\nNote that the character\ + \ encoding of the contents of the diff is\nunspecified as Git and Mercurial\ + \ do not track this, making it hard for\nBitbucket to reliably determine this." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "path" + in: "query" + description: "When used, only one the diff of the specified file will be returned." + required: false + type: "string" + x-exportParamName: "Path" + - name: "encoded_id" + in: "path" + description: "The snippet id." + required: true + type: "string" + x-exportParamName: "EncodedId" + - name: "revision" + in: "path" + description: "A revspec expression. This can simply be a commit SHA1, a ref\ + \ name, or a compare expression like `staging..production`." + required: true + type: "string" + x-exportParamName: "Revision" + responses: + 200: + description: "The raw diff contents." + 403: + description: "If the authenticated user does not have access to the snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + /snippets/{username}/{encoded_id}/watchers: + get: + tags: + - "snippets" + description: "Returns a paginated list of all users watching a specific snippet." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + description: "The snippet id." + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 200: + description: "The paginated list of users watching this snippet" + schema: + $ref: "#/definitions/paginated_users" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + deprecated: true + /repositories/{username}/{repo_slug}/branch-restrictions/{id}: + get: + tags: + - "branchrestrictions" + description: "Returns a specific branch restriction rule." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "id" + in: "path" + description: "The restriction rule's id" + required: true + type: "string" + x-exportParamName: "Id" + responses: + 200: + description: "The branch restriction rule" + schema: + $ref: "#/definitions/branchrestriction" + 401: + description: "If the request was not authenticated" + schema: + $ref: "#/definitions/error" + 403: + description: "If the authenticated user does not have admin access to the\ + \ repository" + schema: + $ref: "#/definitions/error" + 404: + description: "If the repository or branch restriction id does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + put: + tags: + - "branchrestrictions" + description: "Updates an existing branch restriction rule.\n\nFields not present\ + \ in the request body are ignored.\n\nSee [`POST`](../../branch-restrictions#post)\ + \ for details." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "id" + in: "path" + description: "The restriction rule's id" + required: true + type: "string" + x-exportParamName: "Id" + - in: "body" + name: "_body" + description: "The new version of the existing rule" + required: true + schema: + $ref: "#/definitions/branchrestriction" + x-exportParamName: "Body" + responses: + 200: + description: "The updated branch restriction rule" + schema: + $ref: "#/definitions/branchrestriction" + 401: + description: "If the request was not authenticated" + schema: + $ref: "#/definitions/error" + 403: + description: "If the authenticated user does not have admin access to the\ + \ repository" + schema: + $ref: "#/definitions/error" + 404: + description: "If the repository or branch restriction id does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + delete: + tags: + - "branchrestrictions" + description: "Deletes an existing branch restriction rule." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "id" + in: "path" + description: "The restriction rule's id" + required: true + type: "string" + x-exportParamName: "Id" + responses: + 204: + description: "" + 401: + description: "If the request was not authenticated" + schema: + $ref: "#/definitions/error" + 403: + description: "If the authenticated user does not have admin access to the\ + \ repository" + schema: + $ref: "#/definitions/error" + 404: + description: "If the repository or branch restriction id does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}: + get: + tags: + - "pipelines" + description: "Retrieve a given step of a pipeline." + operationId: "getPipelineStepForRepository" + parameters: + - name: "username" + in: "path" + description: "The account." + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "The repository." + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "pipeline_uuid" + in: "path" + description: "The UUID of the pipeline." + required: true + type: "string" + x-exportParamName: "PipelineUuid" + - name: "step_uuid" + in: "path" + description: "The UUID of the step." + required: true + type: "string" + x-exportParamName: "StepUuid" + responses: + 200: + description: "The step." + schema: + $ref: "#/definitions/pipeline_step" + 404: + description: "No account, repository, pipeline or step with the UUID provided\ + \ exists for the pipeline with the UUID provided." + schema: + $ref: "#/definitions/error" + /repositories/{username}/{repo_slug}/commit/{node}/statuses/build: + post: + tags: + - "repositories" + - "commitstatuses" + description: "Creates a new build status against the specified commit.\n\nIf\ + \ the specified key already exists, the existing status object will\nbe overwritten.\n\ + \nWhen creating a new commit status, you can use a URI template for the URL.\n\ + Templates are URLs that contain variable names that Bitbucket will\nevaluate\ + \ at runtime whenever the URL is displayed anywhere similar to\nparameter\ + \ substitution in\n[Bitbucket Connect](https://developer.atlassian.com/bitbucket/concepts/context-parameters.html).\n\ + For example, one could use `https://foo.com/builds/{repository.full_name}`\n\ + which Bitbucket will turn into `https://foo.com/builds/foo/bar` at render\ + \ time.\nThe context variables available are `repository` and `commit`." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "node" + in: "path" + description: "The commit's SHA1" + required: true + type: "string" + x-exportParamName: "Node" + - in: "body" + name: "_body" + description: "The new commit status object." + required: false + schema: + $ref: "#/definitions/commitstatus" + x-exportParamName: "Body" + responses: + 201: + description: "The newly created build status object." + schema: + $ref: "#/definitions/commitstatus" + 401: + description: "If the repository is private and the request was not authenticated." + 404: + description: "If the repository, commit, or build status key does not exist" + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}: + get: + tags: + - "repositories" + description: "Returns the object describing this repository." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + 200: + description: "The repository object." + schema: + $ref: "#/definitions/repository" + 403: + description: "If the repository is private and the authenticated user does\ + \ not have access to it." + schema: + $ref: "#/definitions/error" + 404: + description: "If no repository exists at this location." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + post: + tags: + - "repositories" + description: "Creates a new repository.\n\nNote: In order to set the project\ + \ for the newly created repository,\npass in either the project key or the\ + \ project UUID as part of the\nrequest body as shown in the examples below:\n\ + \n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\n \"\ + scm\": \"git\",\n \"project\": {\n \"key\": \"MARS\"\n }\n}'\ + \ https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding\n```\n\ + \nor\n\n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\n\ + \ \"scm\": \"git\",\n \"project\": {\n \"key\": \"{ba516952-992a-4c2d-acbd-17d502922f96}\"\ + \n }\n}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding\n\ + ```\n\nThe project must only be assigned for repositories belonging to a team.\n\ + If the repository owner is a team and the project is not provided, the\nrepository\ + \ is automatically assigned to the oldest project in the team.\n\nNote: In\ + \ the examples above, the username `teamsinspace`,\nand/or the repository\ + \ name `hablanding` can be replaced by UUIDs." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The repository that is to be created. Note that most object\ + \ elements are optional. Elements \"owner\" and \"full_name\" are ignored\ + \ as the URL implies them." + required: false + schema: + $ref: "#/definitions/repository" + x-exportParamName: "Body" + responses: + 200: + description: "The newly created repository." + schema: + $ref: "#/definitions/repository" + 400: + description: "If the input document was invalid, or if the caller lacks\ + \ the privilege to create repositories under the targeted account." + schema: + $ref: "#/definitions/error" + 401: + description: "If the request was not authenticated." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + put: + tags: + - "repositories" + description: "Since this endpoint can be used to both update and to create a\n\ + repository, the request body depends on the intent.\n\n### Creation\n\nSee\ + \ the POST documentation for the repository endpoint for an example\nof the\ + \ request body.\n\n### Update\n\nNote: Changing the `name` of the repository\ + \ will cause the location to\nbe changed. This is because the URL of the repo\ + \ is derived from the\nname (a process called slugification). In such a scenario,\ + \ it is\npossible for the request to fail if the newly created slug conflicts\n\ + with an existing repository's slug. But if there is no conflict,\nthe new\ + \ location will be returned in the `Location` header of the\nresponse." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - in: "body" + name: "_body" + description: "The repository that is to be updated.\n\nNote that the elements\ + \ \"owner\" and \"full_name\" are ignored since the\nURL implies them.\n" + required: false + schema: + $ref: "#/definitions/repository" + x-exportParamName: "Body" + responses: + 200: + description: "The existing repository has been updated" + schema: + $ref: "#/definitions/repository" + headers: + Location: + type: "string" + description: "The location of the repository. This header is only\n\ + provided when the repository's name is changed." + 201: + description: "A new repository has been created" + schema: + $ref: "#/definitions/repository" + headers: + Location: + type: "string" + description: "The location of the newly created repository" + 400: + description: "If the input document was invalid, or if the caller lacks\ + \ the privilege to create repositories under the targeted account." + schema: + $ref: "#/definitions/error" + 401: + description: "If the request was not authenticated." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + delete: + tags: + - "repositories" + description: "Deletes the repository. This is an irreversible operation.\n\n\ + This does not affect its forks." + parameters: + - name: "username" + in: "path" + description: "This can either be the username or the UUID of the user,\nsurrounded\ + \ by curly-braces, for example: `{user UUID}`.\n" + required: true + type: "string" + x-exportParamName: "Username" + - name: "repo_slug" + in: "path" + description: "This can either be the repository slug or the UUID of the repository,\n\ + surrounded by curly-braces, for example: `{repository UUID}`.\n" + required: true + type: "string" + x-exportParamName: "RepoSlug" + - name: "redirect_to" + in: "query" + description: "If a repository has been moved to a new location, use this parameter\ + \ to\nshow users a friendly message in the Bitbucket UI that the repository\n\ + has moved to a new location. However, a GET to this endpoint will still\n\ + return a 404.\n" + required: false + type: "string" + x-exportParamName: "RedirectTo" + responses: + 204: + description: "Indicates successful deletion." + 403: + description: "If the caller either does not have admin access to the repository,\ + \ or the repository is set to read-only." + schema: + $ref: "#/definitions/error" + 404: + description: "If the repository does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:delete" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/default-reviewers/{target_username}: + get: + tags: + - "pullrequests" + description: "Returns the specified reviewer.\n\nThis can be used to test whether\ + \ a user is among the repository's\ndefault reviewers list. A 404 indicates\ + \ that that specified user is not\na default reviewer." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "target_username" + in: "path" + required: true + type: "string" + x-exportParamName: "TargetUsername" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + put: + tags: + - "pullrequests" + description: "Adds the specified user to the repository's list of default\n\ + reviewers.\n\nThis method is idempotent. Adding a user a second time has no\ + \ effect." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "target_username" + in: "path" + required: true + type: "string" + x-exportParamName: "TargetUsername" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + delete: + tags: + - "pullrequests" + description: "Removes a default reviewer from the repository." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "target_username" + in: "path" + required: true + type: "string" + x-exportParamName: "TargetUsername" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "repository:admin" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/issues/{issue_id}/comments: + get: + tags: + - "issue_tracker" + description: "Returns all comments that were made on the specified issue.\n\n\ + The default sorting is oldest to newest and can be overridden with\nthe `sort`\ + \ query parameter." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "issue_id" + in: "path" + required: true + type: "string" + x-exportParamName: "IssueId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "issue" + - basic: [] + - api_key: [] + /snippets/{username}/{encoded_id}/{node_id}: + get: + tags: + - "snippets" + description: "Identical to `GET /snippets/encoded_id`, except that this endpoint\n\ + can be used to retrieve the contents of the snippet as it was at an\nolder\ + \ revision, while `/snippets/encoded_id` always returns the\nsnippet's current\ + \ revision.\n\nNote that only the snippet's file contents are versioned, not\ + \ its\nmeta data properties like the title.\n\nOther than that, the two endpoints\ + \ are identical in behavior." + produces: + - "application/json" + - "multipart/related" + - "multipart/form-data" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + description: "The snippet's id." + required: true + type: "string" + x-exportParamName: "EncodedId" + - name: "node_id" + in: "path" + description: "A commit revision (SHA1)." + required: true + type: "string" + x-exportParamName: "NodeId" + responses: + 200: + description: "The snippet object." + schema: + $ref: "#/definitions/snippet" + 401: + description: "If the snippet is private and the request was not authenticated." + schema: + $ref: "#/definitions/error" + 403: + description: "If authenticated user does not have access to the private\ + \ snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet, or the revision does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + put: + tags: + - "snippets" + description: "Identical to `UPDATE /snippets/encoded_id`, except that this endpoint\n\ + takes an explicit commit revision. Only the snippet's \"HEAD\"/\"tip\"\n(most\ + \ recent) version can be updated and requests on all other,\nolder revisions\ + \ fail by returning a 405 status.\n\nUsage of this endpoint over the unrestricted\ + \ `/snippets/encoded_id`\ncould be desired if the caller wants to be sure\ + \ no concurrent\nmodifications have taken place between the moment of the\ + \ UPDATE\nrequest and the original GET.\n\nThis can be considered a so-called\ + \ \"Compare And Swap\", or CAS\noperation.\n\nOther than that, the two endpoints\ + \ are identical in behavior." + consumes: + - "application/json" + - "multipart/related" + - "multipart/form-data" + produces: + - "application/json" + - "multipart/related" + - "multipart/form-data" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + description: "The snippet's id." + required: true + type: "string" + x-exportParamName: "EncodedId" + - name: "node_id" + in: "path" + description: "A commit revision (SHA1)." + required: true + type: "string" + x-exportParamName: "NodeId" + responses: + 200: + description: "The updated snippet object." + schema: + $ref: "#/definitions/snippet" + 401: + description: "If the snippet is private and the request was not authenticated." + schema: + $ref: "#/definitions/error" + 403: + description: "If authenticated user does not have permission to update the\ + \ private snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet or the revision does not exist." + schema: + $ref: "#/definitions/error" + 405: + description: "If `{node_id}` is not the latest revision." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet:write" + - basic: [] + - api_key: [] + delete: + tags: + - "snippets" + description: "Deletes the snippet.\n\nNote that this only works for versioned\ + \ URLs that point to the latest\ncommit of the snippet. Pointing to an older\ + \ commit results in a 405\nstatus code.\n\nTo delete a snippet, regardless\ + \ of whether or not concurrent changes\nare being made to it, use `DELETE\ + \ /snippets/{encoded_id}` instead." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "node_id" + in: "path" + required: true + type: "string" + x-exportParamName: "NodeId" + - name: "encoded_id" + in: "path" + description: "The snippet's id." + required: true + type: "string" + x-exportParamName: "EncodedId" + responses: + 204: + description: "If the snippet was deleted successfully." + 401: + description: "If the snippet is private and the request was not authenticated." + schema: + $ref: "#/definitions/error" + 403: + description: "If authenticated user does not have permission to delete the\ + \ private snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + 405: + description: "If `{node_id}` is not the latest revision." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet:write" + - basic: [] + - api_key: [] + /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/patch: + get: + tags: + - "pullrequests" + description: "" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "pull_request_id" + in: "path" + required: true + type: "string" + x-exportParamName: "PullRequestId" + - name: "repo_slug" + in: "path" + required: true + type: "string" + x-exportParamName: "RepoSlug" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "pullrequest" + - basic: [] + - api_key: [] + /addon/linkers/{linker_key}/values/: + get: + tags: + - "addon" + description: "" + parameters: + - name: "linker_key" + in: "path" + required: true + type: "string" + x-exportParamName: "LinkerKey" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + delete: + tags: + - "addon" + description: "" + parameters: + - name: "linker_key" + in: "path" + required: true + type: "string" + x-exportParamName: "LinkerKey" + responses: + default: + description: "Unexpected error." + schema: + $ref: "#/definitions/error" + security: + - oauth2: [] + - basic: [] + - api_key: [] + /users/{username}/hooks/{uid}: + get: + tags: + - "users" + - "webhooks" + description: "Returns the webhook with the specified id installed on the given\n\ + user account." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "uid" + in: "path" + description: "The installed webhook's id." + required: true + type: "string" + x-exportParamName: "Uid" + responses: + 200: + description: "The webhook subscription object." + schema: + $ref: "#/definitions/webhook_subscription" + 404: + description: "If the webhook or user does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + put: + tags: + - "users" + - "webhooks" + description: "Updates the specified webhook subscription.\n\nThe following properties\ + \ can be mutated:\n\n* `description`\n* `url`\n* `active`\n* `events`" + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "uid" + in: "path" + description: "The installed webhook's id" + required: true + type: "string" + x-exportParamName: "Uid" + responses: + 200: + description: "The webhook subscription object." + schema: + $ref: "#/definitions/webhook_subscription" + 403: + description: "If the authenticated user does not have permission to update\ + \ the webhook." + schema: + $ref: "#/definitions/error" + 404: + description: "If the webhook or user does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + delete: + tags: + - "users" + - "webhooks" + description: "Deletes the specified webhook subscription from the given user\n\ + account." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "uid" + in: "path" + description: "The installed webhook's id" + required: true + type: "string" + x-exportParamName: "Uid" + responses: + 204: + description: "When the webhook was deleted successfully" + 403: + description: "If the authenticated user does not have permission to delete\ + \ the webhook." + schema: + $ref: "#/definitions/error" + 404: + description: "If the webhook or user does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + /teams/{username}/hooks: + get: + tags: + - "teams" + - "webhooks" + description: "Returns a paginated list of webhooks installed on this team." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "The paginated list of installed webhooks." + schema: + $ref: "#/definitions/paginated_webhook_subscriptions" + 403: + description: "If the authenticated user is not an admin on the specified\ + \ team." + schema: + $ref: "#/definitions/error" + 404: + description: "If the specified team does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + post: + tags: + - "teams" + - "webhooks" + description: "Creates a new webhook on the specified team.\n\nTeam webhooks\ + \ are fired for events from all repositories belonging to\nthat team account.\n\ + \nNote that only admins can install webhooks on teams." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + responses: + 201: + description: "The newly installed webhook." + schema: + $ref: "#/definitions/webhook_subscription" + headers: + Location: + type: "string" + description: "The URL of new newly created webhook." + 403: + description: "If the authenticated user is not an admin on the specified\ + \ team." + schema: + $ref: "#/definitions/error" + 404: + description: "If the specified team does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "webhook" + - basic: [] + - api_key: [] + /repositories: + get: + tags: + - "repositories" + description: "Returns a paginated list of all public repositories.\n\nThis endpoint\ + \ also supports filtering and sorting of the results. See\n[filtering and\ + \ sorting](../meta/filtering) for more details." + parameters: + - name: "after" + in: "query" + description: "Filter the results to include only repositories create on or\n\ + after this [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601)\n timestamp.\ + \ Example: `YYYY-MM-DDTHH:mm:ss.sssZ`" + required: false + type: "string" + x-exportParamName: "After" + responses: + 200: + description: "All public repositories." + schema: + $ref: "#/definitions/paginated_repositories" + security: + - oauth2: + - "repository" + - basic: [] + - api_key: [] + /snippets/{username}/{encoded_id}/{revision}/patch: + get: + tags: + - "snippets" + description: "Returns the patch of the specified commit against its first\n\ + parent.\n\nNote that this resource is different in functionality from the\ + \ `diff`\nresource.\n\nThe differences between a diff and a patch are:\n\n\ + * patches have a commit header with the username, message, etc\n* diffs support\ + \ the optional `path=foo/bar.py` query param to filter the\n diff to just\ + \ that one file diff (not supported for patches)\n* for a merge, the diff\ + \ will show the diff between the merge commit and\n its first parent (identical\ + \ to how PRs work), while patch returns a\n response containing separate\ + \ patches for each commit on the second\n parent's ancestry, up to the oldest\ + \ common ancestor (identical to\n its reachability).\n\nNote that the character\ + \ encoding of the contents of the patch is\nunspecified as Git and Mercurial\ + \ do not track this, making it hard for\nBitbucket to reliably determine this." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + - name: "encoded_id" + in: "path" + description: "The snippet id." + required: true + type: "string" + x-exportParamName: "EncodedId" + - name: "revision" + in: "path" + description: "A revspec expression. This can simply be a commit SHA1, a ref\ + \ name, or a compare expression like `staging..production`." + required: true + type: "string" + x-exportParamName: "Revision" + responses: + 200: + description: "The raw patch contents." + 403: + description: "If the authenticated user does not have access to the snippet." + schema: + $ref: "#/definitions/error" + 404: + description: "If the snippet does not exist." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "snippet" + - basic: [] + - api_key: [] + /teams/{username}/members: + get: + tags: + - "teams" + description: "All members of a team.\n\nReturns all members of the specified\ + \ team. Any member of any of the\nteam's groups is considered a member of\ + \ the team. This includes users\nin groups that may not actually have access\ + \ to any of the team's\nrepositories.\n\nNote that members using the \"private\ + \ profile\" feature are not included." + parameters: + - name: "username" + in: "path" + required: true + type: "string" + x-exportParamName: "Username" + responses: + 200: + description: "All members" + schema: + $ref: "#/definitions/user" + 404: + description: "When the team does not exist, or multiple teams with the same\ + \ name exist that differ only in casing and the URL did not match the\ + \ exact casing of a particular one." + schema: + $ref: "#/definitions/error" + security: + - oauth2: + - "account" + - basic: [] + - api_key: [] +securityDefinitions: + basic: + description: "Basic HTTP Authentication as per [RFC-2617](https://tools.ietf.org/html/rfc2617)\ + \ (Digest not supported). Note that Basic Auth with username and password as\ + \ credentials is only available on accounts that have 2-factor-auth / 2-step-verification\ + \ disabled. If you use 2fa, you should authenticate using OAuth2 instead." + type: "basic" + api_key: + description: "API Keys can be used as Basic HTTP Authentication credentials and\ + \ provide a substitute for the account's actual username and password. API Keys\ + \ are only available to team accounts and there is only 1 key per account. API\ + \ Keys do not support scopes and have therefore access to all contents of the\ + \ account." + type: "apiKey" + name: "Authorization" + in: "header" + oauth2: + description: "OAuth 2 as per [RFC-6749](https://tools.ietf.org/html/rfc6749)." + type: "oauth2" + authorizationUrl: "https://bitbucket.org/site/oauth2/authorize" + tokenUrl: "https://bitbucket.org/site/oauth2/access_token" + flow: "accessCode" + scopes: + wiki: "Read and modify your repositories' wikis" + pullrequest:write: "Read and modify your repositories and their pull requests" + pipeline:variable: "Access your repositories' build pipelines and configure\ + \ their variables" + project:write: "Read and modify your team's project settings, and read and transfer\ + \ repositories within your team's projects" + pipeline:write: "Access and rerun your repositories' build pipelines" + snippet: "Read your snippets" + repository:delete: "Delete your repositories" + repository:write: "Read and modify your repositories" + issue: "Read your repositories' issues" + email: "Read your account's primary email address" + repository: "Read your repositories" + issue:write: "Read and modify your repositories' issues" + webhook: "Read and modify your repositories' webhooks" + pipeline: "Access your repositories' build pipelines" + snippet:write: "Read and modify your snippets" + account: "Read your account information" + repository:admin: "Administer your repositories" + pullrequest: "Read your repositories and their pull requests" + project: "Read your team's project settings and read repositories contained\ + \ within your team's projects" + team: "Read your team membership information" + team:write: "Read and modify your team membership information" + account:write: "Read and modify your account information" +definitions: + paginated_files: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/commit_file" + minItems: 0 + description: "A paginated list of commit_file objects." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - path: "path" + commit: "" + attributes: "link" + type: "type" + - path: "path" + commit: "" + attributes: "link" + type: "type" + page: 1 + pagelen: 1 + paginated_repository_permissions: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/repository_permission" + minItems: 0 + description: "A paginated list of repository permissions." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - permission: "admin" + type: "type" + repository: "" + user: "" + - permission: "admin" + type: "type" + repository: "" + user: "" + page: 1 + pagelen: 1 + pipeline_image: + type: "object" + properties: + username: + type: "string" + description: "The username needed to authenticate with the Docker registry.\ + \ Only required when using a private Docker image." + password: + type: "string" + description: "The password needed to authenticate with the Docker registry.\ + \ Only required when using a private Docker image." + name: + type: "string" + description: "The name of the image. If the image is hosted on DockerHub the\ + \ short name can be used, otherwise the fully qualified name is required\ + \ here." + email: + type: "string" + description: "The email needed to authenticate with the Docker registry. Only\ + \ required when using a private Docker image." + description: "The definition of a Docker image that can be used for a Bitbucket\ + \ Pipelines step execution context." + milestone: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/milestone_links" + name: + type: "string" + id: + type: "integer" + description: "A milestone as defined in a repository's issue tracker." + paginated_repositories: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/repository" + minItems: 0 + description: "A paginated list of repositories." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + subject_types: + type: "object" + properties: + repository: + $ref: "#/definitions/subject_types_repository" + user: + $ref: "#/definitions/subject_types_repository" + team: + $ref: "#/definitions/subject_types_repository" + description: "The mapping of resource/subject types pointing to their individual\ + \ event types." + example: + team: + events: + name: "name" + href: "http://example.com/aeiou" + repository: + events: + name: "name" + href: "http://example.com/aeiou" + user: + events: + name: "name" + href: "http://example.com/aeiou" + pipeline_state_completed_stopped: + allOf: + - $ref: "#/definitions/pipeline_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the stopped result (STOPPED)." + enum: + - "STOPPED" + description: "A Bitbucket Pipelines STOPPED pipeline result." + paginated_projects: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/project" + minItems: 0 + description: "A paginated list of projects" + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + pullrequest_merge_parameters: + type: "object" + required: + - "type" + properties: + type: + type: "string" + message: + type: "string" + description: "The commit message that will be used on the resulting commit." + close_source_branch: + type: "boolean" + description: "Whether the source branch should be deleted. If this is not\ + \ provided, we fallback to the value used when the pull request was created,\ + \ which defaults to False" + merge_strategy: + type: "string" + description: "The merge strategy that will be used to merge the pull request." + default: "merge_commit" + enum: + - "merge_commit" + - "squash" + description: "The metadata that describes a pull request merge." + pipeline_step_state_pending: + allOf: + - $ref: "#/definitions/pipeline_step_state" + - type: "object" + properties: + name: + type: "string" + description: "The name of pipeline step state (PENDING)." + enum: + - "PENDING" + description: "A Bitbucket Pipelines PENDING pipeline step state." + group: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/group_links" + owner: + $ref: "#/definitions/account" + name: + type: "string" + slug: + type: "string" + description: "The \"sluggified\" version of the group's name. This contains\ + \ only ASCII\ncharacters and can therefore be slightly different than\ + \ the name" + full_slug: + type: "string" + description: "The concatenation of the owner's username and the group's\ + \ slug,\nseparated with a colon (e.g. `acme:developers`)\n" + members: + type: "integer" + description: "The number of members in this group" + description: "A group object" + paginated_milestones: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/milestone" + minItems: 0 + description: "A paginated list of issue tracker milestones." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + paginated_pipeline_variables: + type: "object" + properties: + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + values: + type: "array" + description: "The values of the current page." + items: + $ref: "#/definitions/pipeline_variable" + minItems: 0 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + description: "A paged list of variables." + example: + next: "http://example.com/aeiou" + size: 6 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 0 + pipeline_commit_target: + allOf: + - $ref: "#/definitions/pipeline_target" + - type: "object" + properties: + commit: + $ref: "#/definitions/commit" + selector: + $ref: "#/definitions/pipeline_selector" + description: "A Bitbucket Pipelines commit target." + pipeline_schedule_execution_executed: + allOf: + - $ref: "#/definitions/pipeline_schedule_execution" + - type: "object" + properties: + pipeline: + description: "The pipeline that was triggered by this execution of a schedule." + $ref: "#/definitions/pipeline" + description: "A Pipelines executed schedule execution." + pipeline_ssh_public_key: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + key_type: + type: "string" + description: "The type of the public key." + md5_fingerprint: + type: "string" + description: "The MD5 fingerprint of the public key." + sha256_fingerprint: + type: "string" + description: "The SHA-256 fingerprint of the public key." + key: + type: "string" + description: "The base64 encoded public key." + description: "A Pipelines known host public key." + paginated_pipeline_steps: + type: "object" + properties: + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + values: + type: "array" + description: "The values of the current page." + items: + $ref: "#/definitions/pipeline_step" + minItems: 0 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + description: "A paged list of pipeline steps." + example: + next: "http://example.com/aeiou" + size: 6 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 0 + paginated_team_permissions: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/team_permission" + minItems: 0 + description: "A paginated list of team permissions." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - permission: "admin" + team: "" + type: "type" + user: "" + - permission: "admin" + team: "" + type: "type" + user: "" + page: 1 + pagelen: 1 + paginated_treeentries: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/treeentry" + minItems: 0 + description: "A paginated list of commit_file and/or commit_directory objects." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - path: "path" + commit: "" + type: "type" + - path: "path" + commit: "" + type: "type" + page: 1 + pagelen: 1 + pipeline_ref_target: + allOf: + - $ref: "#/definitions/pipeline_target" + - type: "object" + properties: + commit: + $ref: "#/definitions/commit" + ref_type: + type: "string" + description: "The type of reference (branch/tag)." + enum: + - "branch" + - "tag" + - "named_branch" + - "bookmark" + selector: + $ref: "#/definitions/pipeline_selector" + ref_name: + type: "string" + description: "The name of the reference." + description: "A Bitbucket Pipelines reference target." + pipeline_step_state_completed_error: + allOf: + - $ref: "#/definitions/pipeline_step_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the result (ERROR)" + enum: + - "ERROR" + error: + description: "An error result of a completed state of a Bitbucket Pipeline\ + \ step." + $ref: "#/definitions/pipeline_step_error" + description: "A Bitbucket Pipelines ERROR pipeline step result." + pipeline_step_state_completed_failed: + allOf: + - $ref: "#/definitions/pipeline_step_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the result (FAILED)" + enum: + - "FAILED" + description: "A Bitbucket Pipelines FAILED pipeline step result." + pullrequest: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/pullrequest_links" + id: + type: "integer" + description: "The pull request's unique ID. Note that pull request IDs are\ + \ only unique within their associated repository." + title: + type: "string" + description: "Title of the pull request." + summary: + $ref: "#/definitions/pullrequest_summary" + state: + type: "string" + description: "The pull request's current status." + enum: + - "MERGED" + - "SUPERSEDED" + - "OPEN" + - "DECLINED" + author: + $ref: "#/definitions/account" + source: + $ref: "#/definitions/pullrequest_endpoint" + destination: + $ref: "#/definitions/pullrequest_endpoint" + merge_commit: + $ref: "#/definitions/pullrequest_merge_commit" + comment_count: + type: "integer" + description: "The number of comments for a specific pull request." + minimum: 0 + task_count: + type: "integer" + description: "The number of open tasks for a specific pull request." + minimum: 0 + close_source_branch: + type: "boolean" + description: "A boolean flag indicating if merging the pull request closes\ + \ the source branch." + closed_by: + $ref: "#/definitions/account" + reason: + type: "string" + description: "Explains why a pull request was declined. This field is only\ + \ applicable to pull requests in rejected state." + created_on: + type: "string" + format: "date-time" + description: "The ISO8601 timestamp the request was created." + updated_on: + type: "string" + format: "date-time" + description: "The ISO8601 timestamp the request was last updated." + reviewers: + type: "array" + description: "The list of users that were added as reviewers on this pull\ + \ request when it was created. For performance reasons, the API only includes\ + \ this list on a pull request's `self` URL." + items: + $ref: "#/definitions/account" + participants: + type: "array" + description: " The list of users that are collaborating on this pull\ + \ request.\n Collaborators are user that:\n\n * are added\ + \ to the pull request as a reviewer (part of the reviewers\n \ + \ list)\n * are not explicit reviewers, but have commented on the\ + \ pull request\n * are not explicit reviewers, but have approved\ + \ the pull request\n\n Each user is wrapped in an object that indicates\ + \ the user's role and\n whether they have approved the pull request.\ + \ For performance reasons,\n the API only returns this list when\ + \ an API requests a pull request by\n id.\n " + items: + $ref: "#/definitions/participant" + description: "A pull request object." + pipelines_config: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + enabled: + type: "boolean" + description: "Whether Pipelines is enabled for the repository." + repository: + $ref: "#/definitions/repository" + description: "The Pipelines configuration for a repository." + team: + allOf: + - $ref: "#/definitions/account" + - type: "object" + description: "A team object." + paginated_snippets: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/snippet" + minItems: 0 + description: "A paginated list of snippets." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + page: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + pipeline_state_in_progress_stage: + allOf: + - $ref: "#/definitions/object" + - type: "object" + description: "A result of an in progress pipeline state." + pipeline_step_state_ready: + allOf: + - $ref: "#/definitions/pipeline_step_state" + - type: "object" + properties: + name: + type: "string" + description: "The name of pipeline step state (READY)." + enum: + - "READY" + description: "A Bitbucket Pipelines READY pipeline step state." + pipeline_known_host: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + public_key: + description: "The public key of the known host." + $ref: "#/definitions/pipeline_ssh_public_key" + hostname: + type: "string" + description: "The hostname of the known host." + uuid: + type: "string" + description: "The UUID identifying the known host." + description: "A Pipelines known host." + pipeline_state_completed_expired: + allOf: + - $ref: "#/definitions/pipeline_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the stopped result (EXPIRED)." + enum: + - "EXPIRED" + description: "A Bitbucket Pipelines EXPIRED pipeline result." + pipeline_state_completed: + allOf: + - $ref: "#/definitions/pipeline_state" + - type: "object" + properties: + name: + type: "string" + description: "The name of pipeline state (COMPLETED)." + enum: + - "COMPLETED" + result: + description: "A result of a completed state of a pipeline." + $ref: "#/definitions/pipeline_state_completed_result" + description: "A Bitbucket Pipelines COMPLETED pipeline state." + paginated_ssh_user_keys: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/ssh_account_key" + minItems: 0 + description: "A paginated list of SSH keys." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + pipeline_schedule_execution_errored: + allOf: + - $ref: "#/definitions/pipeline_schedule_execution" + - type: "object" + properties: + error: + description: "The error that caused the execution to fail." + $ref: "#/definitions/pipeline_error" + description: "A Pipelines schedule execution that failed to be executed." + team_permission: + type: "object" + required: + - "type" + properties: + type: + type: "string" + permission: + type: "string" + enum: + - "admin" + - "collaborator" + user: + $ref: "#/definitions/user" + team: + $ref: "#/definitions/team" + description: "A user's permission for a given team." + example: + permission: "admin" + team: "" + type: "type" + user: "" + paginated_log_entries: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + items: + $ref: "#/definitions/issue_change" + minItems: 0 + description: "A paginated list of issue changes." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - issue: "" + created_on: "2000-01-23T04:56:07.000+00:00" + name: "name" + changes: + component: + new: "new" + old: "old" + milestone: + new: "new" + old: "old" + kind: + new: "new" + old: "old" + assignee: + new: "new" + old: "old" + state: + new: "new" + old: "old" + title: + new: "new" + old: "old" + priority: + new: "new" + old: "old" + version: + new: "new" + old: "old" + content: + new: "new" + old: "old" + links: + issue: + name: "name" + href: "http://example.com/aeiou" + self: + name: "name" + href: "http://example.com/aeiou" + type: "type" + message: + markup: "markdown" + raw: "raw" + html: "html" + user: "" + - issue: "" + created_on: "2000-01-23T04:56:07.000+00:00" + name: "name" + changes: + component: + new: "new" + old: "old" + milestone: + new: "new" + old: "old" + kind: + new: "new" + old: "old" + assignee: + new: "new" + old: "old" + state: + new: "new" + old: "old" + title: + new: "new" + old: "old" + priority: + new: "new" + old: "old" + version: + new: "new" + old: "old" + content: + new: "new" + old: "old" + links: + issue: + name: "name" + href: "http://example.com/aeiou" + self: + name: "name" + href: "http://example.com/aeiou" + type: "type" + message: + markup: "markdown" + raw: "raw" + html: "html" + user: "" + page: 1 + pagelen: 1 + paginated_snippet_comments: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/snippet_comment" + minItems: 0 + description: "A paginated list of snippet comments." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + version: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/milestone_links" + name: + type: "string" + id: + type: "integer" + description: "A version as defined in a repository's issue tracker." + issue: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/issue_links" + id: + type: "integer" + repository: + $ref: "#/definitions/repository" + title: + type: "string" + reporter: + $ref: "#/definitions/user" + assignee: + $ref: "#/definitions/user" + created_on: + type: "string" + format: "date-time" + updated_on: + type: "string" + format: "date-time" + edited_on: + type: "string" + format: "date-time" + state: + type: "string" + enum: + - "new" + - "open" + - "resolved" + - "on hold" + - "invalid" + - "duplicate" + - "wontfix" + - "closed" + kind: + type: "string" + enum: + - "bug" + - "enhancement" + - "proposal" + - "task" + priority: + type: "string" + enum: + - "trivial" + - "minor" + - "major" + - "critical" + - "blocker" + milestone: + $ref: "#/definitions/milestone" + version: + $ref: "#/definitions/version" + component: + $ref: "#/definitions/component" + votes: + type: "integer" + content: + $ref: "#/definitions/pullrequest_summary" + description: "An issue." + paginated_pipeline_schedules: + type: "object" + properties: + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + values: + type: "array" + description: "The values of the current page." + items: + $ref: "#/definitions/pipeline_schedule" + minItems: 0 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + description: "A paged list of schedules" + example: + next: "http://example.com/aeiou" + size: 6 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 0 + webhook_subscription: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + uuid: + type: "string" + description: "The webhook's id" + url: + type: "string" + format: "uri" + description: "The URL events get delivered to." + description: + type: "string" + description: "A user-defined description of the webhook." + subject_type: + type: "string" + description: "The type of entity, which is `repository` in the case of webhook\ + \ subscriptions on repositories." + enum: + - "user" + - "repository" + - "team" + subject: + $ref: "#/definitions/object" + active: + type: "boolean" + created_at: + type: "string" + format: "date-time" + events: + type: "array" + description: "The events this webhook is subscribed to." + uniqueItems: true + items: + type: "string" + enum: + - "pullrequest:unapproved" + - "issue:comment_created" + - "pullrequest:approved" + - "repo:created" + - "repo:deleted" + - "repo:imported" + - "pullrequest:comment_updated" + - "issue:updated" + - "project:updated" + - "pullrequest:comment_created" + - "repo:commit_status_updated" + - "pullrequest:updated" + - "issue:created" + - "repo:fork" + - "pullrequest:comment_deleted" + - "repo:commit_status_created" + - "repo:updated" + - "pullrequest:rejected" + - "pullrequest:fulfilled" + - "repo:push" + - "pullrequest:created" + - "repo:transfer" + - "repo:commit_comment_created" + minItems: 1 + description: "A Webhook subscription." + pipeline_variable: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + value: + type: "string" + description: "The value of the variable. If the variable is secured, this\ + \ will be empty." + secured: + type: "boolean" + description: "If true, this variable will be treated as secured. The value\ + \ will never be exposed in the logs or the REST API." + uuid: + type: "string" + description: "The UUID identifying the variable." + key: + type: "string" + description: "The unique name of the variable." + description: "A Pipelines variable." + repository: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/repository_links" + uuid: + type: "string" + description: "The repository's immutable id. This can be used as a substitute\ + \ for the slug segment in URLs. Doing this guarantees your URLs will survive\ + \ renaming of the repository by its owner, or even transfer of the repository\ + \ to a different user." + full_name: + type: "string" + description: "The concatenation of the repository owner's username and the\ + \ slugified name, e.g. \"evzijst/interruptingcow\". This is the same string\ + \ used in Bitbucket URLs." + is_private: + type: "boolean" + parent: + $ref: "#/definitions/repository" + scm: + type: "string" + enum: + - "hg" + - "git" + owner: + $ref: "#/definitions/account" + name: + type: "string" + description: + type: "string" + created_on: + type: "string" + format: "date-time" + updated_on: + type: "string" + format: "date-time" + size: + type: "integer" + language: + type: "string" + has_issues: + type: "boolean" + has_wiki: + type: "boolean" + fork_policy: + type: "string" + description: "\nControls the rules for forking this repository.\n\n* **allow_forks**:\ + \ unrestricted forking\n* **no_public_forks**: restrict forking to private\ + \ forks (forks cannot\n be made public later)\n* **no_forks**: deny all\ + \ forking\n" + enum: + - "allow_forks" + - "no_public_forks" + - "no_forks" + project: + $ref: "#/definitions/project" + description: "A Bitbucket repository." + snippet_commit: + allOf: + - $ref: "#/definitions/base_commit" + - type: "object" + properties: + links: + $ref: "#/definitions/snippet_commit_links" + snippet: + $ref: "#/definitions/snippet" + description: "" + pipeline_state_in_progress_paused: + allOf: + - $ref: "#/definitions/pipeline_state_in_progress_stage" + - type: "object" + properties: + name: + type: "string" + description: "The name of the stage (PAUSED)" + enum: + - "PAUSED" + description: "A Bitbucket Pipelines PAUSED stage of a pipeline that is in progress." + error: + type: "object" + required: + - "type" + properties: + type: + type: "string" + error: + $ref: "#/definitions/error_error" + description: "Base type for most resource objects. It defines the common `type`\ + \ element that identifies an object's type. It also identifies the element as\ + \ Swagger's `discriminator`." + example: + type: "type" + error: + data: "{}" + detail: "detail" + message: "message" + component: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/milestone_links" + name: + type: "string" + id: + type: "integer" + description: "A component as defined in a repository's issue tracker." + base_commit: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + hash: + type: "string" + pattern: "[0-9a-f]{7,}?" + date: + type: "string" + format: "date-time" + author: + $ref: "#/definitions/author" + message: + type: "string" + summary: + $ref: "#/definitions/pullrequest_summary" + parents: + type: "array" + items: + $ref: "#/definitions/base_commit" + minItems: 0 + description: "The common base type for both repository and snippet commits." + pipeline_step_state_completed_expired: + allOf: + - $ref: "#/definitions/pipeline_step_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the result (EXPIRED)" + enum: + - "EXPIRED" + description: "A Bitbucket Pipelines EXPIRED pipeline step result." + pipeline_state_pending: + allOf: + - $ref: "#/definitions/pipeline_state" + - type: "object" + properties: + name: + type: "string" + description: "The name of pipeline state (PENDING)." + enum: + - "PENDING" + description: "A Bitbucket Pipelines PENDING pipeline state." + pipeline_schedule_execution: + allOf: + - $ref: "#/definitions/object" + - type: "object" + description: "A Pipelines schedule execution." + pullrequest_endpoint: + type: "object" + properties: + repository: + $ref: "#/definitions/repository" + branch: + $ref: "#/definitions/pullrequest_endpoint_branch" + commit: + $ref: "#/definitions/pullrequest_merge_commit" + paginated_issue_attachments: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + items: + $ref: "#/definitions/issue_attachment" + minItems: 0 + description: "A paginated list of issue attachments." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + pipeline_step_state_completed: + allOf: + - $ref: "#/definitions/pipeline_step_state" + - type: "object" + properties: + name: + type: "string" + description: "The name of pipeline step state (COMPLETED)." + enum: + - "COMPLETED" + result: + description: "A result of a completed state of a pipeline step." + $ref: "#/definitions/pipeline_step_state_completed_result" + description: "A Bitbucket Pipelines COMPLETED pipeline step state." + pipeline_schedule: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + uuid: + type: "string" + description: "The UUID identifying the schedule." + cron_pattern: + type: "string" + description: "The cron expression that the schedule applies." + enabled: + type: "boolean" + description: "Whether the schedule is enabled." + selector: + $ref: "#/definitions/pipeline_selector" + created_on: + type: "string" + format: "date-time" + description: "The timestamp when the schedule was created." + updated_on: + type: "string" + format: "date-time" + description: "The timestamp when the schedule was updated." + target: + description: "The target on which the schedule will be executed." + $ref: "#/definitions/pipeline_target" + description: "A Pipelines schedule." + pipeline_step_state_completed_successful: + allOf: + - $ref: "#/definitions/pipeline_step_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the result (SUCCESSFUL)" + enum: + - "SUCCESSFUL" + description: "A Bitbucket Pipelines SUCCESSFUL pipeline step result." + pipeline: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + build_number: + type: "integer" + description: "The build number of the pipeline." + target: + description: "The target that the pipeline built." + $ref: "#/definitions/pipeline_target" + repository: + $ref: "#/definitions/repository" + creator: + description: "The Bitbucket account that was used to create the pipeline." + $ref: "#/definitions/account" + created_on: + type: "string" + format: "date-time" + description: "The timestamp when the pipeline was created." + state: + $ref: "#/definitions/pipeline_state" + trigger: + description: "The trigger used for the pipeline." + $ref: "#/definitions/pipeline_trigger" + build_seconds_used: + type: "integer" + description: "The number of build seconds used by this pipeline." + completed_on: + type: "string" + format: "date-time" + description: "The timestamp when the Pipeline was completed. This is not\ + \ set if the pipeline is still in progress." + uuid: + type: "string" + description: "The UUID identifying the pipeline." + description: "A Bitbucket Pipeline. This represents an actual pipeline result." + issue_attachment: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/milestone_links" + name: + type: "string" + description: "An issue file attachment's meta data. Note this does not contain\ + \ the file's actual contents." + paginated_teams: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/team" + minItems: 0 + description: "A paginated list of teams." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + pipeline_trigger_manual: + allOf: + - $ref: "#/definitions/pipeline_trigger" + - type: "object" + description: "A Bitbucket Pipelines MANUAL trigger." + ssh_account_key: + allOf: + - $ref: "#/definitions/ssh_key" + - type: "object" + properties: + owner: + $ref: "#/definitions/account" + description: "Represents an SSH public key for a user." + commit: + allOf: + - $ref: "#/definitions/base_commit" + - type: "object" + properties: + links: + $ref: "#/definitions/commit_links" + repository: + $ref: "#/definitions/repository" + participants: + type: "array" + items: + $ref: "#/definitions/participant" + minItems: 0 + description: "A repository commit object." + pipeline_ssh_key_pair: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + public_key: + type: "string" + description: "The SSH public key." + private_key: + type: "string" + description: "The SSH private key. This value will be empty when retrieving\ + \ the SSH key pair." + description: "A Pipelines SSH key pair." + pipeline_trigger_push: + allOf: + - $ref: "#/definitions/pipeline_trigger" + - type: "object" + description: "A Bitbucket Pipelines PUSH trigger." + comment: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + id: + type: "integer" + created_on: + type: "string" + format: "date-time" + updated_on: + type: "string" + format: "date-time" + content: + $ref: "#/definitions/pullrequest_summary" + user: + $ref: "#/definitions/user" + deleted: + type: "boolean" + parent: + $ref: "#/definitions/comment" + inline: + $ref: "#/definitions/comment_inline" + links: + $ref: "#/definitions/comment_links" + description: "The base type for all comments. This type should be considered\ + \ abstract. Each of the \"commentable\" resources defines its own subtypes\ + \ (e.g. `issue_comment`)." + paginated_pullrequest_comments: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/pullrequest_comment" + minItems: 0 + description: "A paginated list of pullrequest comments." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + paginated_pipeline_schedule_executions: + type: "object" + properties: + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + values: + type: "array" + description: "The values of the current page." + items: + $ref: "#/definitions/pipeline_schedule_execution" + minItems: 0 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + description: "A paged list of the executions of a schedule." + example: + next: "http://example.com/aeiou" + size: 6 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 0 + pipeline_target: + allOf: + - $ref: "#/definitions/object" + - type: "object" + description: "A representation of the target that a pipeline executes on." + pipeline_state_completed_result: + allOf: + - $ref: "#/definitions/object" + - type: "object" + description: "A result of a completed pipeline state." + pipeline_state_in_progress: + allOf: + - $ref: "#/definitions/pipeline_state" + - type: "object" + properties: + name: + type: "string" + description: "The name of pipeline state (IN_PROGRESS)." + enum: + - "IN_PROGRESS" + stage: + description: "A stage of an in progress state of a pipeline." + $ref: "#/definitions/pipeline_state_in_progress_stage" + description: "A Bitbucket Pipelines IN_PROGRESS pipeline state." + pipeline_step_error: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + message: + type: "string" + description: "The error message." + key: + type: "string" + description: "The error key." + description: "An error causing a step failure." + issue_change: + type: "object" + required: + - "type" + properties: + type: + type: "string" + links: + $ref: "#/definitions/issue_change_links" + name: + type: "string" + created_on: + type: "string" + format: "date-time" + user: + $ref: "#/definitions/user" + issue: + $ref: "#/definitions/issue" + changes: + $ref: "#/definitions/issue_change_changes" + message: + $ref: "#/definitions/pullrequest_summary" + description: "An issue change." + example: + issue: "" + created_on: "2000-01-23T04:56:07.000+00:00" + name: "name" + changes: + component: + new: "new" + old: "old" + milestone: + new: "new" + old: "old" + kind: + new: "new" + old: "old" + assignee: + new: "new" + old: "old" + state: + new: "new" + old: "old" + title: + new: "new" + old: "old" + priority: + new: "new" + old: "old" + version: + new: "new" + old: "old" + content: + new: "new" + old: "old" + links: + issue: + name: "name" + href: "http://example.com/aeiou" + self: + name: "name" + href: "http://example.com/aeiou" + type: "type" + message: + markup: "markdown" + raw: "raw" + html: "html" + user: "" + repository_permission: + type: "object" + required: + - "type" + properties: + type: + type: "string" + permission: + type: "string" + enum: + - "admin" + - "write" + - "read" + user: + $ref: "#/definitions/user" + repository: + $ref: "#/definitions/repository" + description: "A user's permission for a given repository." + example: + permission: "admin" + type: "type" + repository: "" + user: "" + pipeline_step_state_completed_stopped: + allOf: + - $ref: "#/definitions/pipeline_step_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the result (STOPPED)" + enum: + - "STOPPED" + description: "A Bitbucket Pipelines STOPPED pipeline step result." + paginated_pipelines: + type: "object" + properties: + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + values: + type: "array" + description: "The values of the current page." + items: + $ref: "#/definitions/pipeline" + minItems: 0 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + description: "A paged list of pipelines" + example: + next: "http://example.com/aeiou" + size: 6 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 0 + pipeline_state_completed_successful: + allOf: + - $ref: "#/definitions/pipeline_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the successful result (SUCCESSFUL)." + enum: + - "SUCCESSFUL" + description: "A Bitbucket Pipelines SUCCESSFUL pipeline result." + pipeline_state: + allOf: + - $ref: "#/definitions/object" + - type: "object" + description: "The representation of the progress state of a pipeline." + paginated_pullrequests: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/pullrequest" + minItems: 0 + description: "A paginated list of pullrequests." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + search_result: + type: "object" + properties: + next: + type: "string" + format: "uri" + previous: + type: "string" + format: "uri" + example: + next: "http://example.com/aeiou" + previous: "http://example.com/aeiou" + pipeline_step: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + completed_on: + type: "string" + format: "date-time" + description: "The timestamp when the step execution was completed. This\ + \ is not set if the step is still in progress." + logByteCount: + type: "integer" + description: "The amount of bytes of the log file that is available." + image: + description: "The Docker image used as the build container for the step." + $ref: "#/definitions/pipeline_image" + started_on: + type: "string" + format: "date-time" + description: "The timestamp when the step execution was started. This is\ + \ not set when the step hasn't executed yet." + script_commands: + type: "array" + description: "The list of build commands. These commands are executed in\ + \ the build container." + items: + $ref: "#/definitions/pipeline_command" + state: + description: "The current state of the step" + $ref: "#/definitions/pipeline_step_state" + setup_commands: + type: "array" + description: "The list of commands that are executed as part of the setup\ + \ phase of the build. These commands are executed outside the build container." + items: + $ref: "#/definitions/pipeline_command" + uuid: + type: "string" + description: "The UUID identifying the step." + description: "A step of a Bitbucket pipeline. This represents the actual result\ + \ of the step execution." + paginated_branchrestrictions: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/branchrestriction" + minItems: 0 + description: "A paginated list of branch restriction rules." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + ssh_key: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + uuid: + type: "string" + description: "The SSH key's immutable ID." + key: + type: "string" + description: "The SSH public key value in OpenSSH format." + comment: + type: "string" + description: "The comment parsed from the SSH key (if present)" + label: + type: "string" + description: "The user-defined label for the SSH key" + created_on: + type: "string" + format: "date-time" + last_used: + type: "string" + format: "date-time" + links: + $ref: "#/definitions/milestone_links" + description: "Base type for representing SSH public keys." + paginated_issues: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/issue" + minItems: 0 + description: "A paginated list of issues." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + commitstatus: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/commitstatus_links" + uuid: + type: "string" + description: "The commit status' id." + key: + type: "string" + description: "An identifier for the status that's unique to\n its\ + \ type (current \"build\" is the only supported type) and the vendor,\n\ + \ e.g. BB-DEPLOY" + refname: + type: "string" + description: "\nThe name of the ref that pointed to this commit at the time\ + \ the status\nobject was created. Note that this the ref may since have\ + \ moved off of\nthe commit. This optional field can be useful for build\ + \ systems whose\nbuild triggers and configuration are branch-dependent\ + \ (e.g. a Pipeline\nbuild).\nIt is legitimate for this field to not be\ + \ set, or even apply (e.g. a\nstatic linting job)." + url: + type: "string" + description: "A URL linking back to the vendor or build system, for providing\ + \ more information about whatever process produced this status. Accepts\ + \ context variables `repository` and `commit` that Bitbucket will evaluate\ + \ at runtime whenever at runtime. For example, one could use https://foo.com/builds/{repository.full_name}\ + \ which Bitbucket will turn into https://foo.com/builds/foo/bar at render\ + \ time." + state: + type: "string" + description: "Provides some indication of the status of this commit" + enum: + - "SUCCESSFUL" + - "FAILED" + - "INPROGRESS" + - "STOPPED" + name: + type: "string" + description: "An identifier for the build itself, e.g. BB-DEPLOY-1" + description: + type: "string" + description: "A description of the build (e.g. \"Unit tests in Bamboo\")" + created_on: + type: "string" + format: "date-time" + updated_on: + type: "string" + format: "date-time" + description: "A commit status object." + account: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/account_links" + username: + type: "string" + pattern: "^[a-zA-Z0-9_\\-]+$" + display_name: + type: "string" + website: + type: "string" + created_on: + type: "string" + format: "date-time" + uuid: + type: "string" + description: "An account object." + paginated_commitstatuses: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/commitstatus" + minItems: 0 + description: "A paginated list of commit status objects." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + pipeline_state_in_progress_running: + allOf: + - $ref: "#/definitions/pipeline_state_in_progress_stage" + - type: "object" + properties: + name: + type: "string" + description: "The name of the stage (RUNNING)" + enum: + - "RUNNING" + description: "A Bitbucket Pipelines RUNNING stage of a pipeline that is in progress." + paginated_snippet_commit: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + items: + $ref: "#/definitions/snippet_commit" + minItems: 0 + description: "A paginated list of snippet commits." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + branchrestriction: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/milestone_links" + id: + type: "integer" + description: "The branch restriction status' id." + kind: + type: "string" + description: "The type of restriction that is being applied" + enum: + - "require_tasks_to_be_completed" + - "require_passing_builds_to_merge" + - "force" + - "require_all_dependencies_merged" + - "push" + - "require_approvals_to_merge" + - "enforce_merge_checks" + - "restrict_merges" + - "reset_pullrequest_approvals_on_change" + - "delete" + users: + type: "array" + items: + $ref: "#/definitions/account" + minItems: 0 + groups: + type: "array" + items: + $ref: "#/definitions/group" + minItems: 0 + value: + type: "integer" + description: "Value with kind-specific semantics: \"require_approvals_to_merge\"\ + \ uses it to require a minimum number of approvals on a PR; \"require_passing_builds_to_merge\"\ + \ uses it to require a minimum number of passing builds." + description: "A branch restriction rule." + pipeline_step_state_completed_result: + allOf: + - $ref: "#/definitions/object" + - type: "object" + description: "A result of a completed pipeline step state." + pipeline_trigger: + allOf: + - $ref: "#/definitions/object" + - type: "object" + description: "A representation of the trigger used for a pipeline." + project: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/project_links" + uuid: + type: "string" + description: "The project's immutable id." + key: + type: "string" + description: "The project's key." + owner: + $ref: "#/definitions/team" + name: + type: "string" + description: "The name of the project." + description: + type: "string" + is_private: + type: "boolean" + description: "\nIndicates whether the project is publicly accessible, or\ + \ whether it is\nprivate to the team and consequently only visible to\ + \ team members.\nNote that private projects cannot contain public repositories." + created_on: + type: "string" + format: "date-time" + updated_on: + type: "string" + format: "date-time" + description: "A Bitbucket project.\n Projects are used by teams to\ + \ organize repositories." + pipeline_log_range: + type: "object" + properties: + last_byte_position: + type: "integer" + description: "The position of the last byte of the range in the log." + first_byte_position: + type: "integer" + description: "The position of the first byte of the range in the log." + description: "A reference to a range of bytes in a log file (does not contain\ + \ the actual bytes)." + pipeline_error: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + message: + type: "string" + description: "The error message." + key: + type: "string" + description: "The error key." + description: "An error causing a pipeline failure." + paginated_hook_events: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/hook_event" + minItems: 0 + description: "A paginated list of webhook types available to subscribe on." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - description: "description" + label: "label" + event: "pullrequest:unapproved" + category: "category" + - description: "description" + label: "label" + event: "pullrequest:unapproved" + category: "category" + page: 1 + pagelen: 1 + pullrequest_comment: + allOf: + - $ref: "#/definitions/comment" + - type: "object" + properties: + pull_request: + $ref: "#/definitions/pullrequest" + description: "A pullrequest comment." + tag: + type: "object" + required: + - "type" + properties: + type: + type: "string" + links: + $ref: "#/definitions/tag_links" + name: + type: "string" + description: "The name of the tag." + target: + $ref: "#/definitions/commit" + message: + type: "string" + description: "The message associated with the tag, if available." + date: + type: "string" + format: "date-time" + description: "The date that the tag was created, if available" + tagger: + $ref: "#/definitions/author" + description: "A tag object, representing a tag in a repository." + example: + date: "2000-01-23T04:56:07.000+00:00" + tagger: "" + name: "name" + links: + self: + name: "name" + href: "http://example.com/aeiou" + commits: + name: "name" + href: "http://example.com/aeiou" + html: + name: "name" + href: "http://example.com/aeiou" + type: "type" + message: "message" + target: "" + participant: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + user: + $ref: "#/definitions/user" + role: + type: "string" + enum: + - "PARTICIPANT" + - "REVIEWER" + approved: + type: "boolean" + participated_on: + type: "string" + format: "date-time" + description: "The ISO8601 timestamp of the participant's action. For approvers,\ + \ this is the time of their approval. For commenters and pull request\ + \ reviewers who are not approvers, this is the time they last commented,\ + \ or null if they have not commented." + description: "Object describing a user's role on resources like commits or pull\ + \ requests." + paginated_versions: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/version" + minItems: 0 + description: "A paginated list of issue tracker versions." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + pipeline_step_state: + allOf: + - $ref: "#/definitions/object" + - type: "object" + description: "The representation of the progress state of a pipeline step." + author: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + raw: + type: "string" + description: "The raw author value from the repository. This may be the\ + \ only value available if the author does not match a user in Bitbucket." + user: + $ref: "#/definitions/account" + description: "The author of a change in a repository" + commit_file: + type: "object" + required: + - "type" + properties: + type: + type: "string" + path: + type: "string" + description: "The path in the repository" + commit: + $ref: "#/definitions/commit" + attributes: + type: "string" + enum: + - "link" + - "executable" + - "subrepository" + - "binary" + - "lfs" + description: "A file object, representing a file at a commit in a repository" + example: + path: "path" + commit: "" + attributes: "link" + type: "type" + snippet: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + id: + type: "integer" + minimum: 0 + title: + type: "string" + scm: + type: "string" + description: "The DVCS used to store the snippet." + enum: + - "hg" + - "git" + created_on: + type: "string" + format: "date-time" + updated_on: + type: "string" + format: "date-time" + owner: + $ref: "#/definitions/account" + creator: + $ref: "#/definitions/account" + is_private: + type: "boolean" + description: "A snippet object." + hook_event: + type: "object" + properties: + event: + type: "string" + description: "The event identifier." + enum: + - "pullrequest:unapproved" + - "issue:comment_created" + - "pullrequest:approved" + - "repo:created" + - "repo:deleted" + - "repo:imported" + - "pullrequest:comment_updated" + - "issue:updated" + - "project:updated" + - "pullrequest:comment_created" + - "repo:commit_status_updated" + - "pullrequest:updated" + - "issue:created" + - "repo:fork" + - "pullrequest:comment_deleted" + - "repo:commit_status_created" + - "repo:updated" + - "pullrequest:rejected" + - "pullrequest:fulfilled" + - "repo:push" + - "pullrequest:created" + - "repo:transfer" + - "repo:commit_comment_created" + category: + type: "string" + description: "The category this event belongs to." + label: + type: "string" + description: "Summary of the webhook event type." + description: + type: "string" + description: "More detailed description of the webhook event type." + description: "An event, associated with a resource or subject type." + example: + description: "description" + label: "label" + event: "pullrequest:unapproved" + category: "category" + pipeline_command: + type: "object" + properties: + command: + type: "string" + description: "The executable command." + name: + type: "string" + description: "The name of the command." + log_range: + description: "The range in the log that contains the execution output of this\ + \ command." + $ref: "#/definitions/pipeline_log_range" + description: "An executable pipeline command." + pipeline_state_completed_error: + allOf: + - $ref: "#/definitions/pipeline_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the result (ERROR)" + enum: + - "ERROR" + error: + description: "An error result of a completed state of a Bitbucket Pipeline." + $ref: "#/definitions/pipeline_error" + description: "A Bitbucket Pipelines ERROR pipeline result." + object: + type: "object" + required: + - "type" + discriminator: "type" + properties: + type: + type: "string" + description: "Base type for most resource objects. It defines the common `type`\ + \ element that identifies an object's type. It also identifies the element as\ + \ Swagger's `discriminator`." + pipeline_step_state_in_progress: + allOf: + - $ref: "#/definitions/pipeline_step_state" + - type: "object" + properties: + name: + type: "string" + description: "The name of pipeline step state (IN_PROGRESS)." + enum: + - "IN_PROGRESS" + description: "A Bitbucket Pipelines IN_PROGRESS pipeline step state." + paginated_components: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/component" + minItems: 0 + description: "A paginated list of issue tracker components." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + user: + allOf: + - $ref: "#/definitions/account" + - type: "object" + properties: + is_staff: + type: "boolean" + account_id: + type: "string" + description: "The user's Atlassian account ID." + description: "A user object." + paginated_webhook_subscriptions: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/webhook_subscription" + minItems: 0 + description: "A paginated list of webhook subscriptions" + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + snippet_comment: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + links: + $ref: "#/definitions/group_links" + snippet: + $ref: "#/definitions/snippet" + description: "A comment on a snippet." + pipeline_build_number: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + next: + type: "integer" + description: "The next number that will be used as build number." + description: "A Pipelines build number." + pipeline_state_completed_failed: + allOf: + - $ref: "#/definitions/pipeline_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the failed result (FAILED)." + enum: + - "FAILED" + description: "A Bitbucket Pipelines FAILED pipeline result." + pipeline_step_state_completed_not_run: + allOf: + - $ref: "#/definitions/pipeline_step_state_completed_result" + - type: "object" + properties: + name: + type: "string" + description: "The name of the result (NOT_RUN)" + enum: + - "NOT_RUN" + description: "A Bitbucket Pipelines NOT_RUN pipeline step result." + paginated_users: + type: "object" + properties: + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + minimum: 0 + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + minimum: 1 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + minimum: 1 + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + values: + type: "array" + uniqueItems: true + items: + $ref: "#/definitions/user" + minItems: 0 + description: "A paginated list of users." + example: + next: "http://example.com/aeiou" + size: 0 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 1 + paginated_pipeline_known_hosts: + type: "object" + properties: + next: + type: "string" + format: "uri" + description: "Link to the next page if it exists. The last page of a collection\ + \ does not have this value. Use this link to navigate the result set and\ + \ refrain from constructing your own URLs." + values: + type: "array" + description: "The values of the current page." + items: + $ref: "#/definitions/pipeline_known_host" + minItems: 0 + pagelen: + type: "integer" + description: "Current number of objects on the existing page. The default\ + \ value is 10 with 100 being the maximum allowed value. Individual APIs\ + \ may enforce different values." + size: + type: "integer" + description: "Total number of objects in the response. This is an optional\ + \ element that is not provided in all responses, as it can be expensive\ + \ to compute." + page: + type: "integer" + description: "Page number of the current results. This is an optional element\ + \ that is not provided in all responses." + previous: + type: "string" + format: "uri" + description: "Link to previous page if it exists. A collections first page\ + \ does not have this value. This is an optional element that is not provided\ + \ in all responses. Some result sets strictly support forward navigation\ + \ and never provide previous links. Clients must anticipate that backwards\ + \ navigation is not always available. Use this link to navigate the result\ + \ set and refrain from constructing your own URLs." + description: "A paged list of known hosts." + example: + next: "http://example.com/aeiou" + size: 6 + previous: "http://example.com/aeiou" + values: + - "" + - "" + page: 1 + pagelen: 0 + pipeline_selector: + allOf: + - $ref: "#/definitions/object" + - type: "object" + properties: + pattern: + type: "string" + description: "The name of the matching pipeline definition." + type: + type: "string" + description: "The type of selector." + enum: + - "branches" + - "tags" + - "bookmarks" + - "default" + - "custom" + description: "A representation of the selector that was used to identify the\ + \ pipeline in the YML file." + treeentry: + type: "object" + required: + - "type" + properties: + type: + type: "string" + path: + type: "string" + description: "The path in the repository" + commit: + $ref: "#/definitions/commit" + description: "Base type for most resource objects. It defines the common `type`\ + \ element that identifies an object's type. It also identifies the element as\ + \ Swagger's `discriminator`." + example: + path: "path" + commit: "" + type: "type" + milestone_links_self: + properties: + href: + type: "string" + format: "uri" + name: + type: "string" + example: + name: "name" + href: "http://example.com/aeiou" + milestone_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + subject_types_repository: + properties: + events: + $ref: "#/definitions/milestone_links_self" + example: + events: + name: "name" + href: "http://example.com/aeiou" + group_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + html: + $ref: "#/definitions/milestone_links_self" + pullrequest_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + html: + $ref: "#/definitions/milestone_links_self" + commits: + $ref: "#/definitions/milestone_links_self" + approve: + $ref: "#/definitions/milestone_links_self" + diff: + $ref: "#/definitions/milestone_links_self" + comments: + $ref: "#/definitions/milestone_links_self" + activity: + $ref: "#/definitions/milestone_links_self" + merge: + $ref: "#/definitions/milestone_links_self" + decline: + $ref: "#/definitions/milestone_links_self" + pullrequest_summary: + properties: + raw: + type: "string" + description: "The text as it was typed by a user." + markup: + type: "string" + description: "The type of markup language the raw content is to be interpreted\ + \ in." + enum: + - "markdown" + - "creole" + - "plaintext" + html: + type: "string" + description: "The user's content rendered as HTML." + example: + markup: "markdown" + raw: "raw" + html: "html" + pullrequest_merge_commit: + properties: + hash: + type: "string" + pattern: "[0-9a-f]{7,}?" + issue_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + html: + $ref: "#/definitions/milestone_links_self" + comments: + $ref: "#/definitions/milestone_links_self" + attachments: + $ref: "#/definitions/milestone_links_self" + watch: + $ref: "#/definitions/milestone_links_self" + vote: + $ref: "#/definitions/milestone_links_self" + repository_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + html: + $ref: "#/definitions/milestone_links_self" + avatar: + $ref: "#/definitions/milestone_links_self" + pullrequests: + $ref: "#/definitions/milestone_links_self" + commits: + $ref: "#/definitions/milestone_links_self" + forks: + $ref: "#/definitions/milestone_links_self" + watchers: + $ref: "#/definitions/milestone_links_self" + downloads: + $ref: "#/definitions/milestone_links_self" + clone: + type: "array" + items: + $ref: "#/definitions/milestone_links_self" + hooks: + $ref: "#/definitions/milestone_links_self" + snippet_commit_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + html: + $ref: "#/definitions/milestone_links_self" + diff: + $ref: "#/definitions/milestone_links_self" + error_error: + required: + - "message" + properties: + message: + type: "string" + detail: + type: "string" + data: + type: "object" + description: "Optional structured data that is endpoint-specific." + properties: {} + example: + data: "{}" + detail: "detail" + message: "message" + pullrequest_endpoint_branch: + properties: + name: + type: "string" + commit_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + html: + $ref: "#/definitions/milestone_links_self" + diff: + $ref: "#/definitions/milestone_links_self" + patch: + $ref: "#/definitions/milestone_links_self" + approve: + $ref: "#/definitions/milestone_links_self" + comments: + $ref: "#/definitions/milestone_links_self" + statuses: + $ref: "#/definitions/milestone_links_self" + comment_inline: + required: + - "path" + properties: + to: + type: "integer" + description: "The comment's anchor line in the new version of the file." + minimum: 1 + from: + type: "integer" + description: "The comment's anchor line in the old version of the file." + minimum: 1 + path: + type: "string" + description: "The path of the file this comment is anchored to." + comment_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + html: + $ref: "#/definitions/milestone_links_self" + code: + $ref: "#/definitions/milestone_links_self" + issue_change_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + issue: + $ref: "#/definitions/milestone_links_self" + example: + issue: + name: "name" + href: "http://example.com/aeiou" + self: + name: "name" + href: "http://example.com/aeiou" + issue_change_changes_assignee: + properties: + old: + type: "string" + new: + type: "string" + example: + new: "new" + old: "old" + issue_change_changes: + properties: + assignee: + $ref: "#/definitions/issue_change_changes_assignee" + state: + $ref: "#/definitions/issue_change_changes_assignee" + title: + $ref: "#/definitions/issue_change_changes_assignee" + kind: + $ref: "#/definitions/issue_change_changes_assignee" + milestone: + $ref: "#/definitions/issue_change_changes_assignee" + component: + $ref: "#/definitions/issue_change_changes_assignee" + priority: + $ref: "#/definitions/issue_change_changes_assignee" + version: + $ref: "#/definitions/issue_change_changes_assignee" + content: + $ref: "#/definitions/issue_change_changes_assignee" + example: + component: + new: "new" + old: "old" + milestone: + new: "new" + old: "old" + kind: + new: "new" + old: "old" + assignee: + new: "new" + old: "old" + state: + new: "new" + old: "old" + title: + new: "new" + old: "old" + priority: + new: "new" + old: "old" + version: + new: "new" + old: "old" + content: + new: "new" + old: "old" + commitstatus_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + commit: + $ref: "#/definitions/milestone_links_self" + account_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + html: + $ref: "#/definitions/milestone_links_self" + avatar: + $ref: "#/definitions/milestone_links_self" + followers: + $ref: "#/definitions/milestone_links_self" + following: + $ref: "#/definitions/milestone_links_self" + repositories: + $ref: "#/definitions/milestone_links_self" + project_links: + properties: + html: + $ref: "#/definitions/milestone_links_self" + avatar: + $ref: "#/definitions/milestone_links_self" + tag_links: + properties: + self: + $ref: "#/definitions/milestone_links_self" + commits: + $ref: "#/definitions/milestone_links_self" + html: + $ref: "#/definitions/milestone_links_self" + example: + self: + name: "name" + href: "http://example.com/aeiou" + commits: + name: "name" + href: "http://example.com/aeiou" + html: + name: "name" + href: "http://example.com/aeiou" +x-radar-pages: +- content: "\n# Authentication methods\n\nThe purpose of this section is to describe\ + \ how to authenticate when making API calls using the Bitbucket REST API.\n\n\ + -----\n\n*On this page*\n\n* [Oauth 2](#oauth-2)\n * [Making requests](#make-requests)\n\ + \ * [Repository cloning](#repo-clone)\n * [Refresh tokens](#refresh-tokens)\n\ + * [Scopes](#scopes-bbc)\n* [App passwords](#app-pw)\n* [Basic auth](#basic-auth)\n\ + \n---\n\n# Bitbucket Cloud OAuth 2.0 \n\nOur OAuth 2 implementation\ + \ is merged in with our existing OAuth 1 in\nsuch a way that existing OAuth 1\ + \ consumers automatically become\nvalid OAuth 2 clients. The only thing you need\ + \ to do is edit your\nexisting consumer and configure a callback URL.\n\nOnce\ + \ that is in place, you'll have the following 2 URLs:\n\n https://bitbucket.org/site/oauth2/authorize\n\ + \ https://bitbucket.org/site/oauth2/access_token\n\nFor obtaining access/bearer\ + \ tokens, we support all 4 of RFC-6749's grant\nflows, plus a custom Bitbucket\ + \ flow for exchanging JWT tokens for access tokens:\n\n\n### 1. Authorization\ + \ Code Grant (4.1)\n\nThe full-blown 3-LO flow. Request authorization from the\ + \ end user by\nsending their browser to:\n\n https://bitbucket.org/site/oauth2/authorize?client_id={client_id}&response_type=code\n\ + \nThe callback includes the `?code={}` query parameter that you can swap\nfor\ + \ an access token:\n\n $ curl -X POST -u \"client_id:secret\" \\\n https://bitbucket.org/site/oauth2/access_token\ + \ \\\n -d grant_type=authorization_code -d code={code}\n\n\n### 2. Implicit\ + \ Grant (4.2)\n\nThis flow is useful for browser-based add-ons that operate without\ + \ server-side backends.\n\nRequest the end user for authorization by directing\ + \ the browser to:\n\n https://bitbucket.org/site/oauth2/authorize?client_id={client_id}&response_type=token\n\ + \nThat will redirect to your preconfigured callback URL with a fragment\ncontaining\ + \ the access token\n(`#access_token={token}&token_type=bearer`) where your page's\ + \ js can\npull it out of the URL.\n\n\n### 3. Resource Owner Password Credentials\ + \ Grant (4.3)\n\nUseful if you have the end user's password but you want to use\ + \ a more\nsecure end user access token instead. This method will not work when\ + \ the user has two-step verification enabled.\n\n $ curl -X POST -u \"client_id:secret\"\ + \ \\\n https://bitbucket.org/site/oauth2/access_token -d grant_type=password\ + \ \\\n -d username={username} -d password={password}\n\n\n### 4. Client Credentials\ + \ Grant (4.4)\n\nSomewhat like our existing \"2-LO\" flow for OAuth 1. Obtain\ + \ an access\ntoken that represents not an end user, but the owner of the\nclient/consumer:\n\ + \n $ curl -X POST -u \"client_id:secret\" \\\n https://bitbucket.org/site/oauth2/access_token\ + \ \\\n -d grant_type=client_credentials\n\n\n### 5. Bitbucket Cloud JWT Grant\ + \ (urn:bitbucket:oauth2:jwt)\n\nIf your Atlassian Connect add-on uses JWT authentication,\ + \ you can swap a\nJWT for an OAuth access token. The resulting access token represents\ + \ the\naccount for which the add-on is installed.\n\nMake sure you send the JWT\ + \ token in the Authorization request header\nusing the \"JWT\" scheme (case sensitive).\ + \ Note that this custom scheme\nmakes this different from HTTP Basic Auth (and\ + \ so you cannot use \"curl\n-u\").\n\n $ curl -X POST -H \"Authorization: JWT\ + \ {jwt_token}\" \\\n https://bitbucket.org/site/oauth2/access_token \\\n\ + \ -d grant_type=urn:bitbucket:oauth2:jwt\n\n\n## Making Requests \n\nOnce you have an access token, as per RFC-6750, you can\ + \ use it in a request in any of\nthe following ways (in decreasing order of desirability):\n\ + \n1. Send it in a request header: `Authorization: Bearer {access_token}`\n2. Include\ + \ it in a (application/x-www-form-urlencoded) POST body as `access_token={access_token}`\n\ + 3. Put it in the query string of a non-POST: `?access_token={access_token}`\n\n\ + \n## Repository Cloning \n\nSince add-ons will not\ + \ be able to upload their own SSH keys to clone\nwith, access tokens can be used\ + \ as Basic HTTP Auth credentials to\nclone securely over HTTPS. This is much like\ + \ GitHub, yet slightly\ndifferent:\n\n $ git clone https://x-token-auth:{access_token}@bitbucket.org/user/repo.git\n\ + \nThe literal string `x-token-auth` as a substitute for username is\nrequired\ + \ (note the difference with GitHub where the actual token is in\nthe username\ + \ field).\n\n\n## Refresh Tokens \n\nOur access\ + \ tokens expire in one hour. When this happens you'll get 401\nresponses.\n\n\ + Most access tokens grant responses (Implicit and JWT excluded). Therefore, you\ + \ should include a\nrefresh token that can then be used to generate a new access\ + \ token,\nwithout the need for end user participation:\n\n $ curl -X POST -u\ + \ \"client_id:secret\" \\\n https://bitbucket.org/site/oauth2/access_token\ + \ \\\n -d grant_type=refresh_token -d refresh_token={refresh_token}\n\n\n\ + # Scopes for the Bitbucket Cloud REST API \n\nBitbucket's\ + \ API applies a number of privilege scopes to endpoints. In order to access an\ + \ endpoint, a request will need to have the necessary scopes.\n\nScopes are declared\ + \ in the descriptor as a list of strings, with each string being the name of a\ + \ unique scope.\n\nA descriptor lacking the `scopes` element is implicitly assumed\ + \ to require all scopes and as a result, Bitbucket will require end users authorizing/installing\ + \ the add-on\nto explicitly accept all scopes.\n\nOur best practice suggests you\ + \ add the scopes your add-on needs, but no more than it needs.\n\nInvalid scope\ + \ strings will cause the descriptor to be rejected and the installation to fail.\n\ + \nFollowing is the set of all currently available scopes.\n\n### repository\n\n\ + Gives the add-on read access to all the repositories the authorizing user has\ + \ access to.\nNote that this scope does not give access to a repository's pull\ + \ requests.\n\n* access to the repo's source code\n* clone over https\n* access\ + \ the the file browsing API\n* download zip archives of the repo's contents\n\ + * the ability to view and use the issue tracker on any repo (created issues, comment,\ + \ vote, etc)\n* the ability to view and use the wiki on any repo (create/edit\ + \ pages)\n\n### repository:write\n\nGives the add-on write (not admin) access\ + \ to all the repositories the authorizing user has access to. No distinction is\ + \ made between public or private repos. This scope implies `repository`, which\ + \ does not need to be requested separately.\nThis scope alone does not give access\ + \ to the pull requests API.\n\n* push access over https\n* fork repos\n\n### repository:admin\n\ + \nGives the add-on admin access to all the repositories the authorizing user has\ + \ access to. No distinction is made between public or private repos. This scope\ + \ does not imply `repository` or `repository:write`. It gives access to the admin\ + \ features of a repo only, not direct access to its contents. Of course it can\ + \ be (mis)used to grant read access to another user account who can then clone\ + \ the repo, but repos that need to read of write source code would also request\ + \ explicit read or write.\nThis scope comes with access to the following functionality:\n\ + \n* view and manipulate committer mappings\n* list and edit deploy keys\n* ability\ + \ to delete the repo\n* view and edit repo permissions\n* view and edit branch\ + \ permissions\n* import and export the issue tracker\n* enable and disable the\ + \ issue tracker\n* list and edit issue tracker version, milestones and components\n\ + * enable and disable the wiki\n* list and edit default reviewers\n* list and edit\ + \ repo links (Jira/Bamboo/Custom)\n* list and edit the repository web hooks\n\ + * initiate a repo ownership transfer\n\n### snippet\n\nGives the add-on read access\ + \ to all the snippets the authorizing user has access to.\nNo distinction is made\ + \ between public and private snippets (public snippets are accessible without\ + \ any form of authentication).\n\n* view any snippet\n* create snippet comments\n\ + \n### snippet:write\n\nGives the add-on write access to all the snippets the authorizing\ + \ user can edit.\nNo distinction is made between public and private snippets (public\ + \ snippets are accessible without any form of authentication).\nThis implies the\ + \ Snippet Read scope which does not need to be requested separately.\n\n* edit\ + \ snippets\n* delete snippets\n\n### issue\n\nAbility to interact with issue trackers\ + \ the way non-repo members can.\nThis scope does not imply any other scopes and\ + \ does not give implicit access to the repository the issue is attached to.\n\n\ + * view, list and search issues\n* create new issues\n* comment on issues\n* watch\ + \ issues\n* vote for issues\n\n### issue:write\n\nThis implies `issue`, but adds\ + \ the ability to transition and delete issues.\nThis scope does not imply any\ + \ other scopes and does not give implicit access to the repository the issue is\ + \ attached to.\n\n* transition issues\n* delete issues\n\n### wiki\n\nGives access\ + \ to wikis. No distinction is made between read and write as wikis are always\ + \ editable by anyone.\nThis scope does not imply any other scopes and does not\ + \ give implicit access to the repository the wiki is attached to.\n\n* view wikis\n\ + * create pages\n* edit pages\n* push to wikis\n* clone wikis\n\n### pullrequest\n\ + \nGives the add-on read access to pull requests.\nThis scope implies `repository`,\ + \ giving read access to the pull request's destination repository.\n\n* see and\ + \ list pull requests\n* create and resolve tasks\n\n### pullrequest:write\n\n\ + Implies `pullrequest` but adds the ability to create, merge and decline pull requests.\n\ + This scope implies `repository:write`, giving write access to the pull request's\ + \ destination repository. This is necessary to facilitate merging.\n\n* merge\ + \ pull requests\n* decline pull requests\n* create pull requests\n* comment on\ + \ pull requests\n* approve pull requests\n\n### email\n\nAbility to see the user's\ + \ primary email address. This should make it easier to use Bitbucket Cloud as\ + \ a login provider to add-ons or external applications.\n\n### account\n\nAbility\ + \ to see all the user's account information. Note that this does not include any\ + \ ability to mutate any of the data.\n\n* see all email addresses\n* language\n\ + * location\n* website\n* full name\n* SSH keys\n* user groups\n\n### account:write\n\ + \nAbility to change properties on the user's account.\n\n* delete the authorizing\ + \ user's account\n* manage the user's groups\n* manupilate a user's email addresses\n\ + * change username, display name and avatar\n\n### team\n\nThe ability to find\ + \ out what teams the current user is part of. This is covered by the teams endpoint.\n\ + \n* information about all the groups and teams I am a member or admin of\n\n\n\ + ### team:write\n\nImplies `team`, but adds the ability to manage the teams that\ + \ the authorizing user is an admin on.\n\n* manage team permissions\n\n### webhook\n\ + \nGives access to webhooks. This scope is required for any webhook\nrelated operation.\n\ + \nThis scope gives read access to existing webhook subscriptions on all\nresources\ + \ you can access, without needing further scopes. This means that\na client can\ + \ list all existing webhook subscriptions on repository\n`foo/bar` (assuming the\ + \ principal user has access to this repo). The\nadditional `repository` scope\ + \ is not required for this.\n\nLikewise, existing webhook subscriptions for a\ + \ repo's issue tracker can be\nretrieved without holding the `issue` scope. All\ + \ that is required is the\n`webhook` scope.\n\nHowever, to create a webhook for\ + \ `issue:created`, the client will need to\nhave both the `webhook` as well as\ + \ `issue` scope.\n\n* list webhook subscriptions on any accessible repository,\ + \ user, team, or snippet\n* create/update/delete webhook subscriptions\n\n\n#\ + \ App passwords \n\nApp passwords allow two-step verification\ + \ users to make API calls to their Bitbucket account through apps such as Sourcetree.\n\ + \nSome important points about app passwords:\n\n* You cannot view an app password\ + \ or adjust permissions after you create the app password. Because app passwords\ + \ are encrypted on our database and cannot be viewed by anyone. They are essentially\ + \ designed to be disposable. If you need to change the scopes or lost the password\ + \ just create a new one.\n* You cannot use them to log into your Bitbucket account.\n\ + * You cannot use app passwords to manage team actions.\n\n App passwords are\ + \ tied to an individual account's credentials and should not be shared. If you're\ + \ sharing your app password you're essentially giving direct, authenticated, access\ + \ to everything that password has been scoped to do with the Bitbucket API's.\n\ + \n* You can use them for API call authentication, even if you don't have two-step\ + \ verification enabled.\n* You can set permission scopes (specific access rights)\ + \ for each app password.\n\n### Create an app password\n\nTo create an app password:\n\ + \n1. Select **Avatar > Bitbucket settings**.\n2. Click **App passwords** in the\ + \ Access management section.\n3. Click **Create app password**.\n4. Give the app\ + \ password a name related to the application that will use the password.\n5. Select\ + \ the specific access and permissions you want this application password to have.\n\ + 6. Copy the generated password and either record or paste it into the application\ + \ you want to give access. The password is only displayed this one time.\n\nThat's\ + \ all there is to creating an app password. See your applications documentation\ + \ for how to apply the app password for a specific application.\n\n## Basic auth\ + \ \n\nBasic HTTP Authentication as per [RFC-2617](https://tools.ietf.org/html/rfc2617)\ + \ (Digest not supported). Note that Basic Auth with username and password as credentials\ + \ is only available on accounts that have 2-factor-auth / 2-step-verification\ + \ disabled. If you use 2fa, you should authenticate using OAuth2 instead.\n" + title: "Authentication methods" + description: "How to authenticate API actions" + key: "authentication" + icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOTcuNjQ3MyAxODYuODEzOCI+CiAgPGRlZnM+CiAgICA8c3R5bGU+CiAgICAgIC5jbHMtMSB7CiAgICAgICAgaXNvbGF0aW9uOiBpc29sYXRlOwogICAgICB9CgogICAgICAuY2xzLTIgewogICAgICAgIGZpbGw6ICNkZTM1MGI7CiAgICAgIH0KCiAgICAgIC5jbHMtMyB7CiAgICAgICAgZmlsbDogI2ZmNTYzMDsKICAgICAgfQoKICAgICAgLmNscy00IHsKICAgICAgICBmaWxsOiAjZGZlMWU1OwogICAgICAgIG1peC1ibGVuZC1tb2RlOiBtdWx0aXBseTsKICAgICAgfQoKICAgICAgLmNscy01IHsKICAgICAgICBmaWxsOiAjZmFmYmZjOwogICAgICB9CgogICAgICAuY2xzLTYgewogICAgICAgIGZpbGw6ICNlYmVjZjA7CiAgICAgIH0KCiAgICAgIC5jbHMtNyB7CiAgICAgICAgZmlsbDogbm9uZTsKICAgICAgICBzdHJva2U6ICMwMDY1ZmY7CiAgICAgICAgc3Ryb2tlLW1pdGVybGltaXQ6IDEwOwogICAgICAgIHN0cm9rZS13aWR0aDogMnB4OwogICAgICB9CgogICAgICAuY2xzLTggewogICAgICAgIGZpbGw6ICM1ZTZjODQ7CiAgICAgIH0KCiAgICAgIC5jbHMtOSB7CiAgICAgICAgZmlsbDogIzI1Mzg1ODsKICAgICAgfQoKICAgICAgLmNscy0xMCB7CiAgICAgICAgZmlsbDogIzI2ODRmZjsKICAgICAgfQoKICAgICAgLmNscy0xMSB7CiAgICAgICAgZmlsbDogIzAwNjVmZjsKICAgICAgfQogICAgPC9zdHlsZT4KICA8L2RlZnM+CiAgPHRpdGxlPlNlY3VyaXR5IHdpdGggS2V5PC90aXRsZT4KICA8ZyBjbGFzcz0iY2xzLTEiPgogICAgPGcgaWQ9IkxheWVyXzIiIGRhdGEtbmFtZT0iTGF5ZXIgMiI+CiAgICAgIDxnIGlkPSJPYmplY3RzIj4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Ik00Mi4wNjcyLDBoLjYxMTRhOCw4LDAsMCwxLDgsOFYyMy4yMzM4YTAsMCwwLDAsMSwwLDBIMzQuMDY3MmEwLDAsMCwwLDEsMCwwVjhBOCw4LDAsMCwxLDQyLjA2NzIsMFoiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Ik0xMDguMjIsMGguNjExNGE4LDgsMCwwLDEsOCw4VjIzLjIzMzhhMCwwLDAsMCwxLDAsMEgxMDAuMjJhMCwwLDAsMCwxLDAsMFY4QTgsOCwwLDAsMSwxMDguMjIsMFoiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Ik0xNzQuMzcyMiwwaC42MTE0YTgsOCwwLDAsMSw4LDhWMjMuMjMzOGEwLDAsMCwwLDEsMCwwSDE2Ni4zNzIyYTAsMCwwLDAsMSwwLDBWOEE4LDgsMCwwLDEsMTc0LjM3MjIsMFoiLz4KICAgICAgICA8cmVjdCBjbGFzcz0iY2xzLTIiIHg9IjM0LjA2NzIiIHk9IjIzLjIzMzgiIHdpZHRoPSIxNjMuNTgiIGhlaWdodD0iMTYzLjU4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy0yIiBkPSJNNDIuMDY3MiwwSDU5LjI5YTgsOCwwLDAsMSw4LDhWMjMuMjIyOGEwLDAsMCwwLDEsMCwwSDM0LjA2NzJhMCwwLDAsMCwxLDAsMFY4YTgsOCwwLDAsMSw4LThaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy0yIiBkPSJNMTA3LjI0NTgsMGgxNy4yMjI4YTgsOCwwLDAsMSw4LDhWMjMuMjIyOGEwLDAsMCwwLDEsMCwwSDk5LjI0NThhMCwwLDAsMCwxLDAsMFY4YTgsOCwwLDAsMSw4LThaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy0yIiBkPSJNMTcyLjQyNDQsMGgxNy4yMjI4YTgsOCwwLDAsMSw4LDhWMjMuMjIyOGEwLDAsMCwwLDEsMCwwSDE2NC40MjQ0YTAsMCwwLDAsMSwwLDBWOGE4LDgsMCwwLDEsOC04WiIvPgogICAgICAgIDxyZWN0IGNsYXNzPSJjbHMtMyIgeD0iMTcuNDU1OCIgeT0iMjMuMjMzOCIgd2lkdGg9IjE2My41OCIgaGVpZ2h0PSIxNjMuNTgiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTMiIGQ9Ik0yNS40NTU4LDBINDIuNjc4NmE4LDgsMCwwLDEsOCw4VjIzLjIyMjhhMCwwLDAsMCwxLDAsMEgxNy40NTU4YTAsMCwwLDAsMSwwLDBWOEE4LDgsMCwwLDEsMjUuNDU1OCwwWiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtMyIgZD0iTTkwLjYzNDQsMGgxNy4yMjI4YTgsOCwwLDAsMSw4LDhWMjMuMjIyOGEwLDAsMCwwLDEsMCwwSDgyLjYzNDRhMCwwLDAsMCwxLDAsMFY4QTgsOCwwLDAsMSw5MC42MzQ0LDBaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy0zIiBkPSJNMTU1LjgxMywwaDE3LjIyMjhhOCw4LDAsMCwxLDgsOFYyMy4yMjI4YTAsMCwwLDAsMSwwLDBIMTQ3LjgxM2EwLDAsMCwwLDEsMCwwVjhBOCw4LDAsMCwxLDE1NS44MTMsMFoiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTMiIGQ9Ik0yNS40NTU4LDBINDIuNjc4NmE4LDgsMCwwLDEsOCw4VjIzLjIyMjhhMCwwLDAsMCwxLDAsMEgxNy40NTU4YTAsMCwwLDAsMSwwLDBWOEE4LDgsMCwwLDEsMjUuNDU1OCwwWiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtMyIgZD0iTTkwLjYzNDQsMGgxNy4yMjI4YTgsOCwwLDAsMSw4LDhWMjMuMjIyOGEwLDAsMCwwLDEsMCwwSDgyLjYzNDRhMCwwLDAsMCwxLDAsMFY4QTgsOCwwLDAsMSw5MC42MzQ0LDBaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy0zIiBkPSJNMTU1LjgxMywwaDE3LjIyMjhhOCw4LDAsMCwxLDgsOFYyMy4yMjI4YTAsMCwwLDAsMSwwLDBIMTQ3LjgxM2EwLDAsMCwwLDEsMCwwVjhBOCw4LDAsMCwxLDE1NS44MTMsMFoiLz4KICAgICAgICA8cmVjdCBjbGFzcz0iY2xzLTIiIHg9IjM1Ljc1OTYiIHk9IjU2LjgwNjUiIHdpZHRoPSIzMy4yMjI4IiBoZWlnaHQ9IjE1LjYwMzgiLz4KICAgICAgICA8cmVjdCBjbGFzcz0iY2xzLTIiIHg9IjEzMS4yMDE2IiB5PSIxMzYuOTYxNSIgd2lkdGg9IjMzLjIyMjgiIGhlaWdodD0iMTUuNjAzOCIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtNCIgZD0iTTU3LjM3MDksNzEuNjAzNmg3MC43NWE5LDksMCwwLDEsOSw5djM1LjM3NDlhNDQuMzc0OCw0NC4zNzQ4LDAsMCwxLTQ0LjM3NDgsNDQuMzc0OGgwYTQ0LjM3NDgsNDQuMzc0OCwwLDAsMS00NC4zNzQ4LTQ0LjM3NDhWODAuNjAzNkE5LDksMCwwLDEsNTcuMzcwOSw3MS42MDM2WiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtNSIgZD0iTTY2LjM3MSw2Ni42NjE3aDcwLjc1YTksOSwwLDAsMSw5LDl2MzUuMzc0OWE0NC4zNzQ4LDQ0LjM3NDgsMCwwLDEtNDQuMzc0OCw0NC4zNzQ4aDBBNDQuMzc0OCw0NC4zNzQ4LDAsMCwxLDU3LjM3MSwxMTEuMDM2NlY3NS42NjE3YTksOSwwLDAsMSw5LTlaIi8+CiAgICAgICAgPHBhdGggaWQ9Il9SZWN0YW5nbGVfIiBkYXRhLW5hbWU9IiZsdDtSZWN0YW5nbGUmZ3Q7IiBjbGFzcz0iY2xzLTYiIGQ9Ik02MS4zNzEsNjYuNjYxN2g3MC43NWE5LDksMCwwLDEsOSw5djM1LjM3NDlhNDQuMzc0OCw0NC4zNzQ4LDAsMCwxLTQ0LjM3NDgsNDQuMzc0OGgwQTQ0LjM3NDgsNDQuMzc0OCwwLDAsMSw1Mi4zNzEsMTExLjAzNjZWNzUuNjYxN0E5LDksMCwwLDEsNjEuMzcxLDY2LjY2MTdaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy03IiBkPSJNOTYuNzQ1OSwxNDcuNzQ0MWEzNi43NDg3LDM2Ljc0ODcsMCwwLDEtMzYuNzA3NC0zNi43MDc0Vjc4LjA1ODRhMy43MzMzLDMuNzMzMywwLDAsMSwzLjcyOS0zLjcyOWg2NS45NTYzYTMuNzMzMywzLjczMzMsMCwwLDEsMy43MjksMy43Mjl2MzIuOTc4NEEzNi43NDg2LDM2Ljc0ODYsMCwwLDEsOTYuNzQ1OSwxNDcuNzQ0MVoiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTQiIGQ9Ik0xMDAuNjg5MywxNjMuMzE2N1YxMTEuMDk3M2EzLjk0NDMsMy45NDQzLDAsMCwwLTcuODg4NywwdjUyLjIyYTIyLjUyNTIsMjIuNTI1MiwwLDAsMC0xOC41NDc5LDIyLjE0YzAsLjQ1Ni4wMTc4LjkwNzguMDQ0NywxLjM1NzFIODIuMjFjLS4wNDE0LS40NDc0LS4wNjg4LS44OTktLjA2ODgtMS4zNTcxYTE0LjYyLDE0LjYyLDAsMCwxLDE0LjU5NzQtMTQuNjA0MWwuMDA2MS4wMDA2LjAwNjgtLjAwMDdBMTQuNjIxMSwxNC42MjExLDAsMCwxLDExMS4zNSwxODUuNDU2NmMwLC40NTgxLS4wMjczLjkxLS4wNjg4LDEuMzU3MWg3LjkxMjhjLjAyNjktLjQ0OTMuMDQ0Ny0uOTAxMS4wNDQ3LTEuMzU3MUEyMi41MjU5LDIyLjUyNTksMCwwLDAsMTAwLjY4OTMsMTYzLjMxNjdaIi8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy0yIiB4PSIxNy40NTU4IiB5PSIzNi40NzAyIiB3aWR0aD0iMzMuMjIyOCIgaGVpZ2h0PSIxNS42MDM4Ii8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy0yIiB4PSIxNy40NTU4IiB5PSIxNTguMTIxNyIgd2lkdGg9IjMzLjIyMjgiIGhlaWdodD0iMTUuNjAzOCIvPgogICAgICAgIDxyZWN0IGNsYXNzPSJjbHMtMiIgeD0iMTQ3LjgxMyIgeT0iMzYuNDcwMiIgd2lkdGg9IjMzLjIyMjgiIGhlaWdodD0iMTUuNjAzOCIvPgogICAgICAgIDxyZWN0IGNsYXNzPSJjbHMtMiIgeD0iMTUwLjA2NDMiIHk9IjE1Ny41NTEzIiB3aWR0aD0iMzMuMjIyOCIgaGVpZ2h0PSIxNS42MDM4Ii8+CiAgICAgICAgPHBhdGggaWQ9Il9QYXRoXyIgZGF0YS1uYW1lPSImbHQ7UGF0aCZndDsiIGNsYXNzPSJjbHMtOCIgZD0iTTEwNy41MjU0LDEwMS4wMDI3YTExLjc3OTQsMTEuNzc5NCwwLDEsMC0xOS44Niw4LjU1NDhBNC4wNDE3LDQuMDQxNywwLDAsMSw4OC44NSwxMTMuNjJsLTIuMTA0LDcuMjY4MWEzLDMsMCwwLDAsMi44ODE3LDMuODM0MmgxMi4yMzcxYTMsMywwLDAsMCwyLjg4MTctMy44MzQybC0yLjA5NTktNy4yNGE0LjA3NDMsNC4wNzQzLDAsMCwxLDEuMTgwOC00LjA5NDVBMTEuNzE3MiwxMS43MTcyLDAsMCwwLDEwNy41MjU0LDEwMS4wMDI3WiIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtOSIgZD0iTTEwNC43NDYxLDEyMC44ODc3bC0yLjA5NTktNy4yNGE0LjA3NDQsNC4wNzQ0LDAsMCwxLDEuMTgwOC00LjA5NDUsMTEuNzYyOSwxMS43NjI5LDAsMCwwLTUuMDYtMTkuOTMxMywxMS45MSwxMS45MSwwLDAsMC04Ljc5OCwxMC45OTQ5LDExLjcxODUsMTEuNzE4NSwwLDAsMCwzLjY5MjksOC45NDFBNC4wNDE2LDQuMDQxNiwwLDAsMSw5NC44NSwxMTMuNjJsLTMuMjE0LDExLjEwMjNoMTAuMjI4OEEzLDMsMCwwLDAsMTA0Ljc0NjEsMTIwLjg4NzdaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy0xMCIgZD0iTTgxLjc5NzUsMTAwLjMxYTMuOTQzOSwzLjk0MzksMCwwLDAtMy45NDQzLTMuOTQ0M0g0MS4wNDE3YTMuOTQ0MywzLjk0NDMsMCwwLDAsMCw3Ljg4ODdINzcuODUzMkEzLjk0MzksMy45NDM5LDAsMCwwLDgxLjc5NzUsMTAwLjMxWiIvPgogICAgICAgIDxwYXRoIGlkPSJfUGF0aF8yIiBkYXRhLW5hbWU9IiZsdDtQYXRoJmd0OyIgY2xhc3M9ImNscy0xMSIgZD0iTTQxLjA0MTYsMTA0LjI1MzlIOTYuODUzMmEzLjk0NDMsMy45NDQzLDAsMCwwLDAtNy44ODg3SDQxLjA0MTZhMy45NDQzLDMuOTQ0MywwLDAsMCwwLDcuODg4N1oiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTEwIiBkPSJNODEuNzk3NSwxMDAuMzFhMy45NDM5LDMuOTQzOSwwLDAsMC0zLjk0NDMtMy45NDQzSDQxLjA0MTdhMy45NDQzLDMuOTQ0MywwLDAsMCwwLDcuODg4N0g3Ny44NTMyQTMuOTQzOSwzLjk0MzksMCwwLDAsODEuNzk3NSwxMDAuMzFaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy0xMCIgZD0iTTIyLjQ5MzIsMTIyLjgwMjlBMjIuNDkyOSwyMi40OTI5LDAsMSwxLDQ0Ljk4NTgsMTAwLjMxLDIyLjUxODUsMjIuNTE4NSwwLDAsMSwyMi40OTMyLDEyMi44MDI5Wm0wLTM3LjA5NzJBMTQuNjA0MiwxNC42MDQyLDAsMSwwLDM3LjA5NzIsMTAwLjMxLDE0LjYyMDcsMTQuNjIwNywwLDAsMCwyMi40OTMyLDg1LjcwNTdaIi8+CiAgICAgIDwvZz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPgo=" +- content: "\n# Filter and sort API objects\n\nYou can query the 2.0 API for specific\ + \ objects using a simple language which resembles SQL.\n\n---\n**On this page**\n\ + \n* [Supported endpoints](#supp-endpoints)\n* [Operators](#operators)\n* [Data\ + \ types](#data-types)\n* [Querying](#querying)\n * [Repositoriess](#query-repo)\n\ + \ * [Pull requests](#query-pullreq)\n * [Issues](#query-issues)\n * [Refs,\ + \ tags, bookmarks](#query-ref)\n* [Sorting query results](#query-sort)\n\n----\n\ + \n### Supported endpoints \n\nSeveral 2.0 API resources\ + \ that return collections of objects all support a single, shared, generic querying\ + \ language that is used to filter down a result set.\n\nCurrently, the endpoints\ + \ which support filtering and sorting include:\n\n /2.0/repositories/{username}\n\ + \ /2.0/repositories/{username}/{slug}/refs\n /2.0/repositories/{username}/{slug}/refs/branches\n\ + \ /2.0/repositories/{username}/{slug}/refs/tags\n /2.0/repositories/{username}/{slug}/forks\n\ + \ /2.0/repositories/{username}/{slug}/src\n /2.0/repositories/{username}/{slug}/issues\n\ + \ /2.0/repositories/{username}/{slug}/pullrequests\n\nFiltering and sorting\ + \ supports several distinct operators and data types as well as basic features,\ + \ like logical operators (AND, OR) as shown in the following examples:\n\n\t(state\ + \ = \"open\" OR state = \"new\") AND assignee = null\n\treporter.username != \"\ + evzijst\" AND priority >= \"major\"\n\t(title ~ \"unicode\" OR content.raw ~ \"\ + unicode\") AND created_on > 2015-10-04T14:00:00-07:00\n\nFilter queries can be\ + \ added to the URL using the q= query parameter. To sort the response,\ + \ add sort=. Note that the entire query string is put in the q parameter\ + \ and hence needs to be URL-encoded as shown in the following example:\n\n\t/2.0/repositories/foo/bar/issues?q=state=\"\ + new\"&sort=-updated_on\n\n### Operators \n\nFiltering\ + \ and sorting supports the following operators:\n\n\n \n\ + \ \n \n \n\ + \ \n \n \n \n \ + \ \n \n \n \n \n \n \ + \ \n \n\ + \ \n \n \n \n \n \n\ + \ \n \n \n \n \n \ + \ \n \n \n \n \n \n \n \ + \ \n \n \n \n \n \n\ + \ \n \n \n \n \n \n \n
OperatorDefinitionExample
\"=\"test for equality username\ + \ = \"evzijst\"
\"!=\"not equalis_private != true
\"~\"case-insensitive text\ + \ contains description ~ \"beef\"
\"!~\"case-insensitive not contains\ + \ description !~ \"fubar\"
\">\"greater thanpriority\ + \ > \"major\"
\">=\"greater than or equalpriority <= \"trivial\"\ +
\"<\"less thanid < 1234
\"\ + <=\"less than or equal updated_on\ + \ <= 2015-03-04
\n\n### Data types \n\nFiltering and sorting supports the following data types:\n\ + \n\n \n \n \n\ + \ \n \n \n\ + \ \n \n \n \n \n \n\ + \ \n \n \n \n \n \n\ + \ \n \n\ + \ \n \n \n \n\ + \ \n \n \n \n \n \ + \ \n \n \n
TypeDescriptionExample
Stringany text\ + \ inside double quotes\"foo\"
Numberarbitrary precision integers\ + \ and floats1, -10.302
Nullto test for the absence of a valuenull
booleanthe unquoted strings true or falsetrue,\ + \ false
datetimean unquoted ISO-8601\ + \ date time string with the timezone offset, milliseconds and entire time component\ + \ being optional2015-03-04T14:08:59.123+02:00,\ + \ 2015-03-04T14:08:59 Date time strings are assumed to be in UTC,\ + \ unless an explicit timezone offset is provided.
\n\n\ + ## Querying \n\nObjects can be filtered based on their\ + \ properties. In principle, every element in an object's JSON document can be\ + \ used as a filter criterion.\n\n### Repositories \n\ + \nYou can query the following fields in the repository resource:\n\n uuid (string)\n\ + \ full_name (string)\n scm (string)\n owner (embedded user object)\n\ + \ name (string)\n description (string)\n created_on (datetime)\n updated_on\ + \ (datetime)\n size (number)\n language (string)\n parent (embedded repository\ + \ object)\n fork_policy (string)\n is_private (boolean)\n has_issues\ + \ (boolean)\n has_wiki (boolean)\n\nFields that contain embedded instances\ + \ of other object types (e.g. owner is an embedded user object, while parent is\ + \ an embedded repository) can be traversed recursively. For instance:\n\n\tparent.owner.username\ + \ = \"bitbucket\"\n\n### Pull Requests \n\nYou can\ + \ query the following fields in the pull request resource:\n\n id (number)\n\ + \ title (string)\n description (string)\n author (embedded user object)\n\ + \ reviewers (embedded user object)\n state (string)\n source.repository\ + \ (embedded repository object)\n source.branch.name (string)\n destination.repository\ + \ (embedded repository object)\n destination.branch.name (string)\n close_source_branch\ + \ (boolean)\n closed_by (embedded user object)\n reason (string)\n created_on\ + \ (datetime)\n updated_on (datetime)\n task_count (number)\n comment_count\ + \ (number)\n\n**For example**\n\nTo find pull requests which merge into master,\ + \ come from a fork of the repo rather than a branch inside the repo, and on which\ + \ I am a reviewer:\n\n```\nsource.repository.full_name != \"main/repo\" AND state\ + \ = \"OPEN\" AND reviewers.username = \"evzijst\" AND destination.branch.name\ + \ = \"master\"\n```\n```\n/2.0/repositories/main/repo/pullrequests?q=source.repository.full_name+%21%3D+%22main%2Frepo%22+AND+state+%3D+%22OPEN%22+AND+reviewers.username+%3D+%22evzijst%22+AND+destination.branch.name+%3D+%22master%22\n\ + ```\n\n### Issues \n\nYou can query the following\ + \ fields in the issues resource:\n\n id (number)\n title (string)\n reporter\ + \ (embedded user object)\n assignee (embedded user object)\n content.raw\ + \ (string)\n created_on (datetime)\n updated_on (datetime)\n state (string)\n\ + \ kind (string)\n priority (string)\n version (string)\n component\ + \ (string)\n milestone (string)\n watches (number)\n votes (number)\n\ + \n**For example**\n\nTo find new or on-hold issues related to the UI, created\ + \ or updated in the last day (SF local time), that have not yet been assigned\ + \ to anyone:\n\n```\n(state = \"new\" OR state = \"on hold\") AND assignee = null\ + \ AND component = \"UI\" and updated_on > 2015-11-11T00:00:00-07:00\n```\n```\n\ + /2.0/repositories/main/repo/issues?q=%28state+%3D+%22new%22+OR+state+%3D+%22on+hold%22%29+AND+assignee+%3D+null+AND+component+%3D+%22UI%22+and+updated_on+%3E+2015-11-11T00%3A00%3A00-07%3A00\n\ + ```\n\n### Refs (Branches/Tags/Bookmarks) \n\nYou can\ + \ query the following fields in the refs resource:\n\n name (string)\n type\ + \ (string)\n\n**For example**\n\nTo find all tags with the string \"2015\" in\ + \ the name:\n\n```\nname ~ \"2015\"\n```\n```\n/2.0/repositories/{username}/{slug}/refs/tags?q=name+%7E+%222015%22\n\ + ```\nOr all my branches and bookmarks:\n\n```\nname ~ \"erik/\"\n```\n```\n/2.0/repositories/{username}/{slug}/refs/tags?q=name+%7E+%22erik%2F%22\n\ + ```\n## Sorting query results \n\nYou can sort result\ + \ sets using the ?sort= query parameter, available on the same resources\ + \ that support filtering:\n\n* In principle, every field that can be queried can\ + \ also be used as a key for sorting.\n* By default the sort order is ascending.\ + \ To reverse the order, prefix the field name with a hyphen (e.g. ?sort=-updated_on).\n\ + * Only one field can be sorted on. Compound fields (e.g. sort on state first,\ + \ followed by updated_on) are not supported.\n\n\n" + title: "Filter and sort API objects" + description: "Query the 2.0 API for specific objects" + key: "filtering" + icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMTk0LjE5MTkgMTQ3LjYwOTIiPgogIDxkZWZzPgogICAgPHN0eWxlPgogICAgICAuY2xzLTEgewogICAgICAgIGlzb2xhdGlvbjogaXNvbGF0ZTsKICAgICAgfQoKICAgICAgLmNscy0yIHsKICAgICAgICBmaWxsOiAjY2ZkNGRiOwogICAgICB9CgogICAgICAuY2xzLTMsIC5jbHMtNCB7CiAgICAgICAgZmlsbDogIzg3NzdkOTsKICAgICAgfQoKICAgICAgLmNscy00IHsKICAgICAgICBtaXgtYmxlbmQtbW9kZTogbXVsdGlwbHk7CiAgICAgIH0KCiAgICAgIC5jbHMtNSB7CiAgICAgICAgZmlsbDogIzAwNjVmZjsKICAgICAgfQoKICAgICAgLmNscy02IHsKICAgICAgICBmaWxsOiAjY2NlMGZmOwogICAgICB9CgogICAgICAuY2xzLTcgewogICAgICAgIGZpbGw6IHVybCgjbGluZWFyLWdyYWRpZW50KTsKICAgICAgfQogICAgPC9zdHlsZT4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50IiB4MT0iNDE2LjMwODIiIHkxPSI3NS4wNDc5IiB4Mj0iNTg0Ljg1NTYiIHkyPSI3NS4wNDc5IiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKC00NDMuOTQ2NyAxMjMuMDY4Nikgcm90YXRlKC0xMy43OTc2KSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNmZmYiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIwLjY5MDgiIHN0b3AtY29sb3I9IiNmZmYiIHN0b3Atb3BhY2l0eT0iMC4xIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8dGl0bGU+TWFnbmlmeWluZyBHbGFzczwvdGl0bGU+CiAgPGcgY2xhc3M9ImNscy0xIj4KICAgIDxnIGlkPSJMYXllcl8yIiBkYXRhLW5hbWU9IkxheWVyIDIiPgogICAgICA8ZyBpZD0iT2JqZWN0cyI+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy0yIiBkPSJNMTMxLjExMjUsOTQuOTMwN2wtOS44ODc4LTUuOTg4OC04LjMyOTIsMTMuNzUxOSw5Ljg4NzgsNS45ODg4YTE1LjYwMywxNS42MDMsMCwwLDEsNS44OCw2LjM4MzVoMGExNS42MDMsMTUuNjAzLDAsMCwwLDUuODgsNi4zODM1bDQwLjExNDMsMjQuMjk2NGExMi44NjY0LDEyLjg2NjQsMCwwLDAsMTcuNjcwOS00LjM0aDBhMTIuODY2NCwxMi44NjY0LDAsMCwwLTQuMzQtMTcuNjcwOUwxNDcuODc0OSw5OS40MzkyYTE1LjYwMywxNS42MDMsMCwwLDAtOC4zODEyLTIuMjU0MmgwQTE1LjYwMywxNS42MDMsMCwwLDEsMTMxLjExMjUsOTQuOTMwN1oiLz4KICAgICAgICA8cGF0aCBpZD0iX1BhdGhfIiBkYXRhLW5hbWU9IiZsdDtQYXRoJmd0OyIgY2xhc3M9ImNscy0zIiBkPSJNMTMxLjExMjUsOTQuOTMwN2wtMy4wMTE4LTEuODI0MkE4LjAzODgsOC4wMzg4LDAsMCwwLDExNy4wNiw5NS44MTc4aDBhOC4wMzg4LDguMDM4OCwwLDAsMCwyLjcxMTMsMTEuMDQwNWwzLjAxMTgsMS44MjQyYTE1LjYwMywxNS42MDMsMCwwLDEsNS44OCw2LjM4MzVoMGExNS42MDMsMTUuNjAzLDAsMCwwLDUuODgsNi4zODM1bDQwLjExNDMsMjQuMjk2NGExMi44NjY0LDEyLjg2NjQsMCwwLDAsMTcuNjcwOS00LjM0aDBhMTIuODY2NCwxMi44NjY0LDAsMCwwLTQuMzQtMTcuNjcwOUwxNDcuODc0OSw5OS40MzkyYTE1LjYwMywxNS42MDMsMCwwLDAtOC4zODEyLTIuMjU0M2gwQTE1LjYwMywxNS42MDMsMCwwLDEsMTMxLjExMjUsOTQuOTMwN1oiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTQiIGQ9Ik0xMzkuMTQzNyw5Ny4xNzkyYTE1LjU5NzMsMTUuNTk3MywwLDAsMS04LjAzMTItMi4yNDg1bC0zLjAxMTgtMS44MjQyQTguMDM4OCw4LjAzODgsMCwwLDAsMTE3LjA2LDk1LjgxNzhoMGE4LjAzODgsOC4wMzg4LDAsMCwwLDIuNzExMywxMS4wNDA1bDMuMDExOCwxLjgyNDJhMTUuNTk3LDE1LjU5NywwLDAsMSw1LjcwNjksNi4wNjQ4LDY3Ljg0ODEsNjcuODQ4MSwwLDAsMCwxMC42NTM2LTE3LjU2ODFaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy01IiBkPSJNODMuMjUzNywxMzIuNTU2QTY3LjIzNDgsNjcuMjM0OCwwLDAsMSw5LjcxLDMyLjQyOTUsNjYuNzk3NCw2Ni43OTc0LDAsMCwxLDUxLjE4MzcsMS45NjY2bC4wMDA3LDBBNjYuNzk2Miw2Ni43OTYyLDAsMCwxLDEwMi4wNTEsOS43NTI1aDBBNjcuMjM0Niw2Ny4yMzQ2LDAsMCwxLDgzLjI1MzcsMTMyLjU1NloiLz4KICAgICAgICA8cGF0aCBpZD0iX1BhdGhfMiIgZGF0YS1uYW1lPSImbHQ7UGF0aCZndDsiIGNsYXNzPSJjbHMtNiIgZD0iTTIzLjQzOSw0MC43NDgyQTUxLjE5MDgsNTEuMTkwOCwwLDAsMCwxMTEuMDEsOTMuNzg4OSw1MS4xOTA4LDUxLjE5MDgsMCwwLDAsMjMuNDM5LDQwLjc0ODJaIi8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy03IiBkPSJNNzkuNDMzLDExNi45ODJBNTEuMjE2Miw1MS4yMTYyLDAsMCwwLDExOC40MjQxLDY3LjAzN2E0OS4xMzkxLDQ5LjEzOTEsMCwwLDEtNS4wODY3LDIuMjc4OWMtMTUuNzAyOSw1Ljk2MDktMjkuNjg5NSwyLjExLTM2LjQ5ODcuMTMwOC0yMC40MzA3LTUuOTM5LTI0Ljc5LTE3LjM3ODUtMzkuMDQxNC0yNC41ODIzYTQ4LjMwOTIsNDguMzA5MiwwLDAsMC0xNC4wOTM5LTQuNTNjLS4wODYyLjEzOTUtLjE3OTMuMjczLS4yNjQ0LjQxMzVBNTEuMTkwNyw1MS4xOTA3LDAsMCwwLDc5LjQzMywxMTYuOTgyWiIvPgogICAgICA8L2c+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K" +- content: "\n# Pagination\n\nEndpoints that return collections of objects should\ + \ always apply pagination.\nPaginated collections are always wrapped in the following\ + \ wrapper object:\n\n```json\n{\n \"size\": 5421,\n \"page\": 2,\n \"pagelen:\ + \ 10,\n \"next\": \"https://api.bitbucket.org/2.0/repositories/pypy/pypy/commits?page=3\"\ + ,\n \"previous\": \"https://api.bitbucket.org/2.0/repositories/pypy/pypy/commits?page=1\"\ + ,\n \"values\": [\n ...\n ]\n}\n```\n\nPagination is often page-bound, with\ + \ a query parameter page indicating which\npage is to be returned.\n\nHowever,\ + \ clients are not expected to construct URLs themselves by manipulating\nthe page\ + \ number query parameter. Instead, the response contains a link to the\nnext page.\ + \ This link should be treated as an opaque location that is not to be\nconstructed\ + \ by clients or even assumed to be predictable. The only contract\naround the\ + \ next link is that it will return the next chunk of results.\n\nLack of a next\ + \ link in the response indicates the end of the collection.\n\nThe paginated response\ + \ contains the following fields:\n\n\n \n \ + \ \n \n \n \n\ + \ \n \n \n \n \n \n\ + \ \n \n \ + \ \n \n \n \n \n\ + \ \n \n \n\ + \ \n \n \n \n \n \n \n\ + \ \n\ + \ \n
FieldValue
sizeTotal\ + \ number of objects in the response. This is an optional element that is not provided\ + \ in all responses, as it can be expensive to compute.
pagePage number of the current results.\ + \ This is an optional element that is not provided in all responses.
pagelenCurrent\ + \ number of objects on the existing page. Globally, the minimum length is 10 and\ + \ the maximum is 100. Some APIs may specify a different default.
nextLink to the next page\ + \ if it exists. The last page of a collection does not have this value. Use this\ + \ link to navigate the result set and refrain from constructing your own URLs.
previousLink\ + \ to previous page if it exists. A collections first page does not have this value.\ + \ This is an optional element that is not provided in all responses. Some result\ + \ sets strictly support forward navigation and never provide previous links. Clients\ + \ must anticipate that backwards navigation is not always available.\n \ + \ Use this link to navigate the result set and refrain from constructing your\ + \ own URLs.
valuesThe list of objects. This contains at most pagelen objects.
\n\nThe link to the next page is included such that you don't\ + \ have to hardcode or construct any links. Only values and next are guaranteed\ + \ (except the last page, which lacks next). This is because the previous and size\ + \ values can be expensive for some data sets.\n\nIt is important to realize that\ + \ Bitbucket support both list-based pagination and iterator-based pagination.\ + \ List-based pagination assumes that the collection is a discrete, immutable,\ + \ consistently ordered, finite array of objects with a fixed size. Clients navigate\ + \ a list-based collection by requesting offset-based chunks. In Bitbucket Cloud,\ + \ list-based responses include the optional size, page, and previous element.\ + \ The the next and previous links typically resemble something like /foo/bar?page=4.\n\ + \nHowever, not all result sets can be treated as immutable and finite – much like\ + \ how programming languages tend to distinguish between lists and arrays on one\ + \ hand and iterators or stream on the other. Where an list-based pagination offers\ + \ random access into any point in a collection, iterator-based pagination can\ + \ only navigate forward one element at a time. In Bitbucket such iterator-based\ + \ pagination contains the next link and pagelen elements, but not necessarily\ + \ anything else. In these cases, the next link's value often contains an unpredictable\ + \ hash instead of an explicit page number. The commits resource uses iterator-based\ + \ pagination.\n" + title: "Pagination" + description: "Learn more about pagination" + key: "pagination" + icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjM4LjgyIDE1MS42Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2IyZDRmZjt9LmNscy0ye2ZpbGw6IzRjOWFmZjt9LmNscy0ze2ZpbGw6IzAwNTJjYzt9LmNscy00e29wYWNpdHk6MC42O30uY2xzLTV7ZmlsbDp1cmwoI2xpbmVhci1ncmFkaWVudCk7fS5jbHMtNntmaWxsOnVybCgjbGluZWFyLWdyYWRpZW50LTIpO30uY2xzLTd7ZmlsbDp1cmwoI2xpbmVhci1ncmFkaWVudC0zKTt9LmNscy04e2ZpbGw6dXJsKCNsaW5lYXItZ3JhZGllbnQtNCk7fS5jbHMtOXtmaWxsOnVybCgjbGluZWFyLWdyYWRpZW50LTUpO30uY2xzLTEwLC5jbHMtMTEsLmNscy0xMntmaWxsOm5vbmU7fS5jbHMtMTB7c3Ryb2tlOiMzMzg0ZmY7fS5jbHMtMTAsLmNscy0xMSwuY2xzLTEyLC5jbHMtMTN7c3Ryb2tlLW1pdGVybGltaXQ6MTA7c3Ryb2tlLXdpZHRoOjJweDt9LmNscy0xMXtzdHJva2U6I2ZmYWIwMDt9LmNscy0xMntzdHJva2U6I2ZhZmJmYzt9LmNscy0xM3tmaWxsOiNmZmFiMDA7c3Ryb2tlOiMyNjg0ZmY7fTwvc3R5bGU+PGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQiIHkxPSI2NS4xNyIgeDI9Ijg2LjM4IiB5Mj0iNjUuMTciIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiM0YzlhZmYiLz48c3RvcCBvZmZzZXQ9IjAuMDgiIHN0b3AtY29sb3I9IiM0YzlhZmYiIHN0b3Atb3BhY2l0eT0iMC45NCIvPjxzdG9wIG9mZnNldD0iMC4yNCIgc3RvcC1jb2xvcj0iIzRjOWFmZiIgc3RvcC1vcGFjaXR5PSIwLjc4Ii8+PHN0b3Agb2Zmc2V0PSIwLjQ1IiBzdG9wLWNvbG9yPSIjNGM5YWZmIiBzdG9wLW9wYWNpdHk9IjAuNTMiLz48c3RvcCBvZmZzZXQ9IjAuNTUiIHN0b3AtY29sb3I9IiM0YzlhZmYiIHN0b3Atb3BhY2l0eT0iMC40Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudC0yIiB4MT0iMTUyLjQ0IiB5MT0iNjUuMTciIHgyPSIyMzguODIiIHkyPSI2NS4xNyIgeGxpbms6aHJlZj0iI2xpbmVhci1ncmFkaWVudCIvPjxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50LTMiIHgxPSIxOC44NSIgeTE9IjExOC43OCIgeDI9IjEyNi4wOCIgeTI9IjExLjU2IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agb2Zmc2V0PSIwLjA2IiBzdG9wLWNvbG9yPSIjMDA2NWZmIi8+PHN0b3Agb2Zmc2V0PSIwLjE5IiBzdG9wLWNvbG9yPSIjMDA2NWZmIiBzdG9wLW9wYWNpdHk9IjAuOTQiLz48c3RvcCBvZmZzZXQ9IjAuNDYiIHN0b3AtY29sb3I9IiMwMDY1ZmYiIHN0b3Atb3BhY2l0eT0iMC43OCIvPjxzdG9wIG9mZnNldD0iMC44MiIgc3RvcC1jb2xvcj0iIzAwNjVmZiIgc3RvcC1vcGFjaXR5PSIwLjUzIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjMDA2NWZmIiBzdG9wLW9wYWNpdHk9IjAuNCIvPjwvbGluZWFyR3JhZGllbnQ+PGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtNCIgeDE9IjExMi43NSIgeTE9IjExOC43OCIgeDI9IjIxOS45NyIgeTI9IjExLjU2IiB4bGluazpocmVmPSIjbGluZWFyLWdyYWRpZW50LTMiLz48bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudC01IiB4MT0iNTAuOTciIHkxPSIxMzMuNjEiIHgyPSIxODcuODYiIHkyPSItMy4yOCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPjxzdG9wIG9mZnNldD0iMC42NiIgc3RvcC1jb2xvcj0iIzI1Mzg1OCIvPjxzdG9wIG9mZnNldD0iMC44OCIgc3RvcC1jb2xvcj0iIzI1Mzg1OCIgc3RvcC1vcGFjaXR5PSIwLjgzIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjMjUzODU4IiBzdG9wLW9wYWNpdHk9IjAuNyIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjx0aXRsZT5WaWV3IFZlcnNpb25zPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU29mdHdhcmUiPjxjaXJjbGUgY2xhc3M9ImNscy0xIiBjeD0iOTQuNTMiIGN5PSIxNDcuOTMiIHI9IjMuNjciLz48Y2lyY2xlIGNsYXNzPSJjbHMtMiIgY3g9IjEwNi45NCIgY3k9IjE0Ny45MyIgcj0iMy42NyIvPjxjaXJjbGUgY2xhc3M9ImNscy0zIiBjeD0iMTE5LjM0IiBjeT0iMTQ3LjkzIiByPSIzLjY3Ii8+PGNpcmNsZSBjbGFzcz0iY2xzLTIiIGN4PSIxMzEuNzUiIGN5PSIxNDcuOTMiIHI9IjMuNjciLz48Y2lyY2xlIGNsYXNzPSJjbHMtMSIgY3g9IjE0NC4xNiIgY3k9IjE0Ny45MyIgcj0iMy42NyIvPjxnIGNsYXNzPSJjbHMtNCI+PHJlY3QgaWQ9Il9SZWN0YW5nbGVfIiBkYXRhLW5hbWU9IiZsdDtSZWN0YW5nbGUmZ3Q7IiBjbGFzcz0iY2xzLTUiIHk9IjI1LjkyIiB3aWR0aD0iODYuMzgiIGhlaWdodD0iNzguNDkiLz48L2c+PGcgY2xhc3M9ImNscy00Ij48cmVjdCBpZD0iX1JlY3RhbmdsZV8yIiBkYXRhLW5hbWU9IiZsdDtSZWN0YW5nbGUmZ3Q7IiBjbGFzcz0iY2xzLTYiIHg9IjE1Mi40NCIgeT0iMjUuOTIiIHdpZHRoPSI4Ni4zOCIgaGVpZ2h0PSI3OC40OSIvPjwvZz48cmVjdCBpZD0iX1JlY3RhbmdsZV8zIiBkYXRhLW5hbWU9IiZsdDtSZWN0YW5nbGUmZ3Q7IiBjbGFzcz0iY2xzLTciIHg9IjE2LjI4IiB5PSIxNC4xMiIgd2lkdGg9IjExMi4zNiIgaGVpZ2h0PSIxMDIuMDkiLz48cmVjdCBpZD0iX1JlY3RhbmdsZV80IiBkYXRhLW5hbWU9IiZsdDtSZWN0YW5nbGUmZ3Q7IiBjbGFzcz0iY2xzLTgiIHg9IjExMC4xOCIgeT0iMTQuMTIiIHdpZHRoPSIxMTIuMzYiIGhlaWdodD0iMTAyLjA5Ii8+PHJlY3QgaWQ9Il9SZWN0YW5nbGVfNSIgZGF0YS1uYW1lPSImbHQ7UmVjdGFuZ2xlJmd0OyIgY2xhc3M9ImNscy05IiB4PSI0Ny42OSIgd2lkdGg9IjE0My40NSIgaGVpZ2h0PSIxMzAuMzQiLz48bGluZSBjbGFzcz0iY2xzLTEwIiB4MT0iNzkuMTYiIHkxPSIxNi4xOCIgeDI9IjExNy4yNCIgeTI9IjE2LjE4Ii8+PGxpbmUgY2xhc3M9ImNscy0xMCIgeDE9IjYyLjkzIiB5MT0iMTYuMTgiIHgyPSI3Mi42IiB5Mj0iMTYuMTgiLz48bGluZSBjbGFzcz0iY2xzLTExIiB4MT0iNzkuMTYiIHkxPSIyNi45NSIgeDI9IjExNy4yNCIgeTI9IjI2Ljk1Ii8+PGxpbmUgY2xhc3M9ImNscy0xMCIgeDE9IjYyLjkzIiB5MT0iMjYuOTUiIHgyPSI3Mi42IiB5Mj0iMjYuOTUiLz48bGluZSBjbGFzcz0iY2xzLTEwIiB4MT0iNzkuMTYiIHkxPSIzNy43MiIgeDI9IjE1MC43IiB5Mj0iMzcuNzIiLz48bGluZSBjbGFzcz0iY2xzLTEwIiB4MT0iNjIuOTMiIHkxPSIzNy43MiIgeDI9IjcyLjYiIHkyPSIzNy43MiIvPjxsaW5lIGNsYXNzPSJjbHMtMTEiIHgxPSIxNTAuNyIgeTE9IjQ4LjQ5IiB4Mj0iMTc1LjU5IiB5Mj0iNDguNDkiLz48bGluZSBjbGFzcz0iY2xzLTEyIiB4MT0iMTEwLjMyIiB5MT0iNDguNDkiIHgyPSIxNDMuMDUiIHkyPSI0OC40OSIvPjxsaW5lIGNsYXNzPSJjbHMtMTEiIHgxPSI3OS4xNiIgeTE9IjQ4LjQ5IiB4Mj0iMTAxLjM3IiB5Mj0iNDguNDkiLz48bGluZSBjbGFzcz0iY2xzLTEwIiB4MT0iNjIuOTMiIHkxPSI0OC40OSIgeDI9IjcyLjYiIHkyPSI0OC40OSIvPjxsaW5lIGNsYXNzPSJjbHMtMTAiIHgxPSI3OS4xNiIgeTE9IjU5LjI2IiB4Mj0iMTUwLjciIHkyPSI1OS4yNiIvPjxsaW5lIGNsYXNzPSJjbHMtMTAiIHgxPSI2Mi45MyIgeTE9IjU5LjI2IiB4Mj0iNzIuNiIgeTI9IjU5LjI2Ii8+PGxpbmUgY2xhc3M9ImNscy0xMCIgeDE9Ijc5LjE2IiB5MT0iNzAuMDMiIHgyPSIxNzUuNTkiIHkyPSI3MC4wMyIvPjxsaW5lIGNsYXNzPSJjbHMtMTAiIHgxPSI2Mi45MyIgeTE9IjcwLjAzIiB4Mj0iNzIuNiIgeTI9IjcwLjAzIi8+PGxpbmUgY2xhc3M9ImNscy0xMSIgeDE9Ijc5LjE2IiB5MT0iODAuNzkiIHgyPSIxMTcuMjQiIHkyPSI4MC43OSIvPjxsaW5lIGNsYXNzPSJjbHMtMTAiIHgxPSI2Mi45MyIgeTE9IjgwLjc5IiB4Mj0iNzIuNiIgeTI9IjgwLjc5Ii8+PGxpbmUgY2xhc3M9ImNscy0xMyIgeDE9Ijc5LjE2IiB5MT0iOTEuNTYiIHgyPSIxNDkuMDYiIHkyPSI5MS41NiIvPjxsaW5lIGNsYXNzPSJjbHMtMTAiIHgxPSI2Mi45MyIgeTE9IjkxLjU2IiB4Mj0iNzIuNiIgeTI9IjkxLjU2Ii8+PGxpbmUgY2xhc3M9ImNscy0xMCIgeDE9IjYyLjkzIiB5MT0iODAuNzkiIHgyPSI3Mi42IiB5Mj0iODAuNzkiLz48bGluZSBjbGFzcz0iY2xzLTEwIiB4MT0iNjIuOTMiIHkxPSI5MS41NiIgeDI9IjcyLjYiIHkyPSI5MS41NiIvPjxsaW5lIGNsYXNzPSJjbHMtMTEiIHgxPSI3OS4xNiIgeTE9IjEwMi4zMyIgeDI9IjExNy4yNCIgeTI9IjEwMi4zMyIvPjxsaW5lIGNsYXNzPSJjbHMtMTAiIHgxPSI2Mi45MyIgeTE9IjEwMi4zMyIgeDI9IjcyLjYiIHkyPSIxMDIuMzMiLz48bGluZSBjbGFzcz0iY2xzLTEwIiB4MT0iMTI1Ljk4IiB5MT0iMTEzLjEiIHgyPSIxNDkuMDYiIHkyPSIxMTMuMSIvPjxsaW5lIGNsYXNzPSJjbHMtMTIiIHgxPSI3OS4xNiIgeTE9IjExMy4xIiB4Mj0iMTE3LjI0IiB5Mj0iMTEzLjEiLz48bGluZSBjbGFzcz0iY2xzLTEwIiB4MT0iNjIuOTMiIHkxPSIxMTMuMSIgeDI9IjcyLjYiIHkyPSIxMTMuMSIvPjwvZz48L2c+PC9zdmc+" +- content: "\n# Partial responses\n\nBy default, each endpoint returns the full representation\ + \ of a resource and in\nsome cases that can be a lot of data. For example, retrieving\ + \ a list of pull\nrequests can amount to quite a large document.\n\nFor better\ + \ performance, you can ask the server to only return the fields you\nreally need\ + \ and to omit unwanted data. To request a partial response and to\nadd or remove\ + \ specific fields from a response, use the `fields` query\nparameter.\n\n\n##\ + \ Example\n\nMost API resources embed a substantial list of links pointing to\ + \ related\nresources. This saves the client from constructing its own URLs, but\ + \ is\nsomewhat wasteful when the client doesn't need them.\n\nTo significantly\ + \ reduce the size of the response, use `?fields=-links`:\n\n```\n$ curl https://api.bitbucket.org/2.0/users/evzijst?fields=-links\n\ + {\n \"username\": \"evzijst\",\n \"website\": \"\",\n \"display_name\": \"\ + Erik van Zijst\",\n \"uuid\": \"{a288a0ab-e13b-43f0-a689-c4ef0a249875}\",\n \ + \ \"created_on\": \"2010-07-07T05:16:36+00:00\",\n \"location\": null,\n \"\ + type\": \"user\"\n}\n```\n\n## Fields parameter syntax\n\nThe `fields` parameter\ + \ supports 3 modes of operation:\n\n1. Removal of select fields (e.g. `-links`)\n\ + 2. Pulling in additional fields not normally returned by an endpoint, while\n\ + \ still getting all the default fields (e.g. `+reviewers`)\n3. Omitting all\ + \ fields, except those specified (e.g. `owner.username`)\n\nThe fields parameter\ + \ can contain a list of multiple comma-separated field names\n(e.g. `fields=owner.username,uuid,links.self.href`).\ + \ The parameter itself is\nnot repeated.\n\nAs discussed at [Condensed Versus\ + \ Full Objects](serialization#representations),\nmost objects that are embedded\ + \ inside other objects (like how `owner` is an\nembedded `user` object in `repository`)\ + \ appear in \"condensed\" form that omits\nmany fields. The `fields` parameter\ + \ allows us to pull in additional fields in\nsuch cases.\n\nFor example, the embedded\ + \ repository object in a pull request does not normally\ncontain its `owner`.\ + \ To add that in we can use:\n`+values.destination.repository.owner`.\n\n\n##\ + \ Wildcards\n\nThe asterisk can be used to match all fields on a particular level.\ + \ For\nexample, removing all entries from the `links` element can be done like\ + \ this:\n\n```\n$ curl https://api.bitbucket.org/2.0/users/evzijst?fields=-links.*\n\ + {\n \"username\": \"evzijst\",\n \"website\": \"\",\n \"display_name\": \"\ + Erik van Zijst\",\n \"uuid\": \"{a288a0ab-e13b-43f0-a689-c4ef0a249875}\",\n \ + \ \"links\": {},\n \"created_on\": \"2010-07-07T05:16:36+00:00\",\n \"location\"\ + : null,\n \"type\": \"user\"\n}\n```\n\nWildcards can be used in combination\ + \ with exclusion and inclusion. For\ninstance, `-*,+foo,+bar` will remove all\ + \ elements from the root level and then\nadd in `foo` and `bar`.\n\n\n## URL encoding\n\ + \nBe aware that when using the `+foo.bar` syntax in the query string, that the\n\ + \"+\" must be URL encoded as \"%2B\" and so the URL will be:\n\n```\nhttps://api.bitbucket.org/2.0/repositories/evzijst/interruptingcow?fields=%2Bowner.created_on\n\ + ```\n\nWithout URL escaping, \"+\" is interpreted as an encoded space which will\ + \ not\nmatch any fields.\n\n\n## Field discovery\n\nWhile a resource's `self`\ + \ URL, as well its \"collection\" URL typically return\nthe full object with all\ + \ its fields, there are some exceptions for fields that\nare overly verbose or\ + \ costly to generate.\n\nFor instance, a pull request contains the embedded lists\ + \ of reviewers and\nparticipants. These fields are included from the `self` URL,\ + \ but not from the\n`/pullrequests` collections resource, as it would impact performance\ + \ too much.\n\nTo discover any additional fields that might not be included by\ + \ default,\n`fields=*` can be used.\n\n\n## More examples\n\nIf we want to get\ + \ a list of all reviewer usernames on pull requests I created,\nwe could combine\ + \ a [filter](filtering) with a partial response. This will omit\nall other data\ + \ from the response:\n\n```\n/2.0/repositories/bitbucket/bitbucket/pullrequests?fields=values.id,values.reviewers.username,values.state&q=author.username%3D%22erik%22\n\ + {\n \"values\": [\n {\n \"reviewers\": [\n {\n \"username\"\ + : \"abhin\"\n },\n {\n \"username\": \"dtao\"\n \ + \ },\n {\n \"username\": \"csomme\"\n }\n ],\n \ + \ \"state\": \"OPEN\",\n \"id\": 11355\n },\n {\n \"reviewers\"\ + : [\n {\n \"username\": \"csomme\"\n },\n {\n \ + \ \"username\": \"abhin\"\n },\n {\n \"username\"\ + : \"dstevens\"\n }\n ],\n \"state\": \"MERGED\",\n \"id\"\ + : 11347\n },\n {\n \"reviewers\": [\n {\n \"username\"\ + : \"csomme\"\n },\n {\n \"username\": \"jmooring\"\n \ + \ },\n {\n \"username\": \"zdavis\"\n },\n \ + \ {\n \"username\": \"flexbox\"\n }\n ],\n \"state\"\ + : \"OPEN\",\n \"id\": 11344\n }\n ]\n}\n```\n" + title: "Partial responses" + description: "Tweak which fields are returned" + key: "partial-response" + icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMTYyLjQ0ODcgMjEwLjExMTUiPgogIDxkZWZzPgogICAgPHN0eWxlPgogICAgICAuY2xzLTEgewogICAgICAgIGlzb2xhdGlvbjogaXNvbGF0ZTsKICAgICAgfQoKICAgICAgLmNscy0yLCAuY2xzLTYsIC5jbHMtOCB7CiAgICAgICAgZmlsbDogbm9uZTsKICAgICAgfQoKICAgICAgLmNscy0yLCAuY2xzLTggewogICAgICAgIHN0cm9rZTogIzAwNjVmZjsKICAgICAgICBzdHJva2Utd2lkdGg6IDJweDsKICAgICAgfQoKICAgICAgLmNscy0yIHsKICAgICAgICBzdHJva2UtbGluZWpvaW46IHJvdW5kOwogICAgICB9CgogICAgICAuY2xzLTMgewogICAgICAgIGZpbGw6ICNlN2U4ZWM7CiAgICAgIH0KCiAgICAgIC5jbHMtNCB7CiAgICAgICAgZmlsbDogI2ZmZTM4MDsKICAgICAgfQoKICAgICAgLmNscy01IHsKICAgICAgICBmaWxsOiAjZmZmMGIyOwogICAgICB9CgogICAgICAuY2xzLTYgewogICAgICAgIHN0cm9rZTogI2ZmOTkxZjsKICAgICAgICBzdHJva2Utd2lkdGg6IDEuODE1NnB4OwogICAgICB9CgogICAgICAuY2xzLTYsIC5jbHMtOCB7CiAgICAgICAgc3Ryb2tlLW1pdGVybGltaXQ6IDEwOwogICAgICB9CgogICAgICAuY2xzLTcgewogICAgICAgIG1peC1ibGVuZC1tb2RlOiBtdWx0aXBseTsKICAgICAgICBmaWxsOiB1cmwoI2xpbmVhci1ncmFkaWVudCk7CiAgICAgIH0KCiAgICAgIC5jbHMtOSB7CiAgICAgICAgZmlsbDogI2Y0ZjVmNzsKICAgICAgfQogICAgPC9zdHlsZT4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50IiB4MT0iMTEzLjM4MTgiIHkxPSI0OS40MyIgeDI9IjE1My43ODkzIiB5Mj0iOS4wMjI1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2ZhZmJmYyIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjAuMjc4NiIgc3RvcC1jb2xvcj0iI2VmZjFmMyIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjAuNzY4OCIgc3RvcC1jb2xvcj0iI2QxZDZkZCIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNjMWM3ZDAiLz4KICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgPC9kZWZzPgogIDx0aXRsZT5Eb2N1bWVudCBUYWJsZTwvdGl0bGU+CiAgPGcgY2xhc3M9ImNscy0xIj4KICAgIDxnIGlkPSJMYXllcl8yIiBkYXRhLW5hbWU9IkxheWVyIDIiPgogICAgICA8ZyBpZD0iT2JqZWN0cyI+CiAgICAgICAgPGxpbmUgY2xhc3M9ImNscy0yIiB4MT0iMTcuNDcxIiB5MT0iMTcxLjc1NzMiIHgyPSI3OS4yOTgiIHkyPSIxNzEuNzU3MyIvPgogICAgICAgIDxwb2x5Z29uIGlkPSJfUGF0aF8iIGRhdGEtbmFtZT0iJmx0O1BhdGgmZ3Q7IiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMTYyLjQ0NSAzOC43MTEgMTYyLjQ0NSAyMTAuMTExIDAgMjEwLjExMSAwIDAgMTIzLjcwNCAwIDE2Mi40MTUgMzguNzExIDE2Mi40NDUgMzguNzExIi8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy00IiB4PSIxOC45MTE3IiB5PSI3OC4xNTQyIiB3aWR0aD0iNDcuODQ4NSIgaGVpZ2h0PSI3OS42NTM3Ii8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy01IiB4PSIxOC45MTE3IiB5PSI1MS42MDMiIHdpZHRoPSIxMjMuNDUyOSIgaGVpZ2h0PSIyNi41NTEyIi8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy02IiB4PSIxOC45MTE3IiB5PSI1MS42MDMiIHdpZHRoPSIxMjMuNDUyOSIgaGVpZ2h0PSIxMDYuMjA0OSIvPgogICAgICAgIDxsaW5lIGNsYXNzPSJjbHMtNiIgeDE9IjY2Ljc2MDEiIHkxPSI1MS42MDMiIHgyPSI2Ni43NjAxIiB5Mj0iMTU3LjgwNzkiLz4KICAgICAgICA8bGluZSBjbGFzcz0iY2xzLTYiIHgxPSI5MS4zMjg0IiB5MT0iNTEuNjAzIiB4Mj0iOTEuMzI4NCIgeTI9IjE1Ny44MDc5Ii8+CiAgICAgICAgPGxpbmUgY2xhc3M9ImNscy02IiB4MT0iMTE1Ljg5NjciIHkxPSI1MS42MDMiIHgyPSIxMTUuODk2NyIgeTI9IjE1Ny44MDc5Ii8+CiAgICAgICAgPGxpbmUgY2xhc3M9ImNscy02IiB4MT0iMTguOTExNyIgeTE9Ijc4LjE1NDIiIHgyPSIxNDIuMzY0NiIgeTI9Ijc4LjE1NDIiLz4KICAgICAgICA8bGluZSBjbGFzcz0iY2xzLTYiIHgxPSIxOC45MTE3IiB5MT0iMTA0LjcwNTUiIHgyPSIxNDIuMzY0NiIgeTI9IjEwNC43MDU1Ii8+CiAgICAgICAgPGxpbmUgY2xhc3M9ImNscy02IiB4MT0iMTguOTExNyIgeTE9IjEzMS4yNTY3IiB4Mj0iMTQyLjM2NDYiIHkyPSIxMzEuMjU2NyIvPgogICAgICAgIDxwb2x5Z29uIGNsYXNzPSJjbHMtNyIgcG9pbnRzPSIxNjIuNDQ1IDM4LjcxMSAxNjIuNDE1IDM4LjcxMSAxMjMuODcyIDAuMTY5IDEyMy44NzIgNTkuOTIxIDE2Mi40NDUgMzkuMTM3IDE2Mi40NDUgMzguNzExIi8+CiAgICAgICAgPGxpbmUgY2xhc3M9ImNscy04IiB4MT0iMTguMzk3MyIgeTE9IjE4MS4zNDQiIHgyPSI3OS4xMTM1IiB5Mj0iMTgxLjM0NCIvPgogICAgICAgIDxsaW5lIGNsYXNzPSJjbHMtOCIgeDE9IjE4LjM5NzMiIHkxPSIxOTAuOTMwNiIgeDI9IjUxLjMwNDkiIHkyPSIxOTAuOTMwNiIvPgogICAgICAgIDxsaW5lIGNsYXNzPSJjbHMtOCIgeDE9IjE4LjM5NzMiIHkxPSIxNzEuNzU3MyIgeDI9Ijc5LjExMzUiIHkyPSIxNzEuNzU3MyIvPgogICAgICAgIDxsaW5lIGNsYXNzPSJjbHMtOCIgeDE9IjE4LjM5NzMiIHkxPSIzNi4xNzA1IiB4Mj0iNzkuMTEzNSIgeTI9IjM2LjE3MDUiLz4KICAgICAgICA8bGluZSBjbGFzcz0iY2xzLTgiIHgxPSIxOC4zOTczIiB5MT0iMjYuNTgzOCIgeDI9Ijc5LjExMzUiIHkyPSIyNi41ODM4Ii8+CiAgICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy05IiBwb2ludHM9IjE2Mi40NDkgMzguNzQyIDEyMy43MDcgMzguNzQyIDEyMy43MDcgMCAxNjIuNDQ5IDM4Ljc0MiIvPgogICAgICA8L2c+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K" +- content: "\n# Open API Specification and Object Representations\n\n----\n\n*On this\ + \ page*\n\n* [Open API Specification](#oai)\n* [JSON Schema](#jsonschema)\n* [Condensed\ + \ Versus Full Objects](#representations)\n\n____\n\n\n## Open API Specification\ + \ \n\nBitbucket uses the [Open API Specification](https://openapis.org)\ + \ (OAI,\nformerly known as Swagger) to describe its APIs. Our OAI specification\ + \ schema\nis hosted at [https://api.bitbucket.org/swagger.json](https://api.bitbucket.org/swagger.json)\n\ + and serves as the canonical definition and comprehensive declaration of all\n\ + available endpoints.\n\nThe OAI specification makes writing client applications\ + \ easier by:\nauto-generating boilerplate code (like data object classes) and\ + \ dealing with\nauthentication and error handling.\n\nYou can find a comprehensive\ + \ set of open tools for the OAI specification at:\n[https://github.com/swagger-api](https://github.com/swagger-api).\n\ + \n\n## JSON Schema \n\nBitbucket uses JSON Schema to\ + \ describe the layout of every type of object\nconsumed or produced by the API.\ + \ These schemas are collected under the\n`#definitions` element of our swagger.json\ + \ file.\n\nWhen an endpoint expects an object as part of a POST or PUT, it also\ + \ expects\nthe object to validate against the JSON schemas. The same applies to\ + \ objects\nreturned by an endpoint.\n\n\n## Condensed Versus Full Objects \n\nMost objects in Bitbucket come both in \"full\" and\ + \ \"partial\" representation.\nThe full representation is when all elements are\ + \ included. This is the layout\nreturned by a resource's `self` location (e.g.\ + \ `/2.0/repositories/foo/bar`),\nas well as resource collection endpoints (e.g.\ + \ `/2.0/repositories`).\n\nHowever, Bitbucket objects often embed other objects.\ + \ For example, a `repository`\nobject embeds a `user` object for its owner. Likewise,\ + \ a `pullrequest` object\nembeds its `repository` object.\n\nThese related objects\ + \ are embedded, or inlined, to reduce the \"chatter\" when\nclients make frequent\ + \ followup API calls to collect information on common,\nrelated information.\n\ + \nEmbedded related objects are typically limited in their fields to avoid such\n\ + object graphs from becoming too deep and noisy. They often exclude their own\n\ + nested objects in an attempt to strike a balance between performance and\nutility.\n\ + \nAn object's embedded or condensed representation tends to be standardized,\n\ + meaning the fields included is the same set, regardless of where the object\n\ + was embedded.\n" + title: "Schemas and Serialization" + description: "Learn more about object representations" + key: "serialization" + icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMjAuNzYyNCAyMDUuNTg2Ij4KICA8ZGVmcz4KICAgIDxzdHlsZT4KICAgICAgLmNscy0xIHsKICAgICAgICBpc29sYXRpb246IGlzb2xhdGU7CiAgICAgIH0KCiAgICAgIC5jbHMtMiwgLmNscy02IHsKICAgICAgICBtaXgtYmxlbmQtbW9kZTogbXVsdGlwbHk7CiAgICAgIH0KCiAgICAgIC5jbHMtMTMsIC5jbHMtMywgLmNscy00LCAuY2xzLTYgewogICAgICAgIGZpbGw6IG5vbmU7CiAgICAgICAgc3Ryb2tlOiAjYzFjN2QwOwogICAgICAgIHN0cm9rZS1saW5lY2FwOiByb3VuZDsKICAgICAgICBzdHJva2UtbWl0ZXJsaW1pdDogMTA7CiAgICAgICAgc3Ryb2tlLXdpZHRoOiAycHg7CiAgICAgIH0KCiAgICAgIC5jbHMtNCB7CiAgICAgICAgc3Ryb2tlLWRhc2hhcnJheTogMy43ODE2IDUuMjk0MzsKICAgICAgfQoKICAgICAgLmNscy01IHsKICAgICAgICBmaWxsOiAjMDA2NWZmOwogICAgICB9CgogICAgICAuY2xzLTYgewogICAgICAgIHN0cm9rZS1kYXNoYXJyYXk6IDMuOTIxOSA1LjQ5MDc7CiAgICAgIH0KCiAgICAgIC5jbHMtNyB7CiAgICAgICAgZmlsbDogIzAwNTJjYzsKICAgICAgfQoKICAgICAgLmNscy04IHsKICAgICAgICBmaWxsOiAjNGM5YWZmOwogICAgICB9CgogICAgICAuY2xzLTkgewogICAgICAgIGZpbGw6ICMwMDQ5YjA7CiAgICAgIH0KCiAgICAgIC5jbHMtMTAgewogICAgICAgIGZpbGw6ICM1N2Q5YTM7CiAgICAgIH0KCiAgICAgIC5jbHMtMTEgewogICAgICAgIGZpbGw6ICM3OWYyYzA7CiAgICAgIH0KCiAgICAgIC5jbHMtMTIgewogICAgICAgIGZpbGw6ICMzNmIzN2U7CiAgICAgIH0KCiAgICAgIC5jbHMtMTMgewogICAgICAgIHN0cm9rZS1kYXNoYXJyYXk6IDMuODY4MSA1LjQxNTQ7CiAgICAgIH0KCiAgICAgIC5jbHMtMTQgewogICAgICAgIGZpbGw6ICM0MjUyNmU7CiAgICAgIH0KCiAgICAgIC5jbHMtMTUgewogICAgICAgIGZpbGw6ICMzNDQ1NjM7CiAgICAgIH0KCiAgICAgIC5jbHMtMTYgewogICAgICAgIGZpbGw6ICM1MDVmNzk7CiAgICAgIH0KICAgIDwvc3R5bGU+CiAgPC9kZWZzPgogIDx0aXRsZT5JbnRlZ3JhdGlvbnM8L3RpdGxlPgogIDxnIGNsYXNzPSJjbHMtMSI+CiAgICA8ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj4KICAgICAgPGcgaWQ9Ik9iamVjdHMiPgogICAgICAgIDxnIGNsYXNzPSJjbHMtMiI+CiAgICAgICAgICA8Zz4KICAgICAgICAgICAgPGxpbmUgY2xhc3M9ImNscy0zIiB4MT0iNzUuMjExNCIgeTE9IjE4Ny44NTczIiB4Mj0iNzcuMDI0OCIgeTI9IjE4Ny4xMTA5Ii8+CiAgICAgICAgICAgIDxsaW5lIGNsYXNzPSJjbHMtNCIgeDE9IjgxLjkyMDUiIHkxPSIxODUuMDk1NiIgeDI9IjEzOC4yMjEyIiB5Mj0iMTYxLjkyMDMiLz4KICAgICAgICAgICAgPGxpbmUgY2xhc3M9ImNscy0zIiB4MT0iMTQwLjY2OSIgeTE9IjE2MC45MTI2IiB4Mj0iMTQyLjQ4MjQiIHkyPSIxNjAuMTY2MiIvPgogICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgICAgICA8cG9seWdvbiBjbGFzcz0iY2xzLTUiIHBvaW50cz0iMTk0LjUyNiAyNi41NTIgMTc2LjkwMSAzOC4yNDEgMTU5LjI3IDI2LjU1MiAxNzYuOTAxIDE0Ljg3IDE5NC41MjYgMjYuNTUyIi8+CiAgICAgICAgPGxpbmUgY2xhc3M9ImNscy02IiB4MT0iMTgzLjcxMzUiIHkxPSI0My4yMTg4IiB4Mj0iMTgzLjcxMzUiIHkyPSI5Ny44ODMyIi8+CiAgICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy03IiBwb2ludHM9IjE3Ni45MDEgMzguMjQxIDE3Ni45MDEgNTguMTY2IDE1OS4yNyA0Ni40NzcgMTU5LjI3IDI2LjU1MiAxNzYuOTAxIDM4LjI0MSIvPgogICAgICAgIDxwb2x5Z29uIGNsYXNzPSJjbHMtOCIgcG9pbnRzPSIxOTQuNTI2IDI2LjU1MiAxOTQuNTI2IDQ2LjQ3NyAxNzYuOTAxIDU4LjE2NiAxNzYuOTAxIDM4LjI0MSAxOTQuNTI2IDI2LjU1MiIvPgogICAgICAgIDxsaW5lIGNsYXNzPSJjbHMtNiIgeDE9IjQ3Ljk0ODgiIHkxPSI0Mi4yMTg4IiB4Mj0iMTU5LjExNzIiIHkyPSI0Mi4yMTg4Ii8+CiAgICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy01IiBwb2ludHM9IjIyMC43NjIgOTkuNzUyIDE2Ny44MTcgMTM0Ljg2NCAxMTQuODU0IDk5Ljc1MiAxNjcuODE3IDY0LjY1NyAyMjAuNzYyIDk5Ljc1MiIvPgogICAgICAgIDxwb2x5Z29uIGNsYXNzPSJjbHMtOSIgcG9pbnRzPSIxNjcuODE3IDEzNC44NjQgMTY3LjgxNyAxOTQuNzE4IDExNC44NTQgMTU5LjYwNiAxMTQuODU0IDk5Ljc1MiAxNjcuODE3IDEzNC44NjQiLz4KICAgICAgICA8cG9seWdvbiBjbGFzcz0iY2xzLTgiIHBvaW50cz0iMjIwLjc2MiA5OS43NTIgMjIwLjc2MiAxNTkuNjA2IDE2Ny44MTcgMTk0LjcxOCAxNjcuODE3IDEzNC44NjQgMjIwLjc2MiA5OS43NTIiLz4KICAgICAgICA8cG9seWdvbiBjbGFzcz0iY2xzLTEwIiBwb2ludHM9IjExMC41NDEgMjEuNjA0IDc3Ljk0OSA0My4yMTkgNDUuMzQ1IDIxLjYwNCA3Ny45NDkgMCAxMTAuNTQxIDIxLjYwNCIvPgogICAgICAgIDxwb2x5Z29uIGNsYXNzPSJjbHMtMTEiIHBvaW50cz0iMTEwLjU0MSAyMS42MDQgMTEwLjU0MSA1OC40NDkgNzcuOTQ5IDgwLjA2NCA3Ny45NDkgNDMuMjE5IDExMC41NDEgMjEuNjA0Ii8+CiAgICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy01IiBwb2ludHM9IjE0MS4xOSAxNDguMDczIDE2Ny44MTMgMTMwLjQxNyAxOTQuNDQ0IDE0OC4wNzMgMTY3LjgxMyAxNjUuNzE5IDE0MS4xOSAxNDguMDczIi8+CiAgICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy05IiBwb2ludHM9IjE2Ny44MTMgMTMwLjQxNyAxNjcuODEzIDEwMC4zMjEgMTk0LjQ0NCAxMTcuOTc2IDE5NC40NDQgMTQ4LjA3MyAxNjcuODEzIDEzMC40MTciLz4KICAgICAgICA8cG9seWdvbiBjbGFzcz0iY2xzLTgiIHBvaW50cz0iMTQxLjE5IDE0OC4wNzMgMTQxLjE5IDExNy45NzYgMTY3LjgxMyAxMDAuMzIxIDE2Ny44MTMgMTMwLjQxNyAxNDEuMTkgMTQ4LjA3MyIvPgogICAgICAgIDxwb2x5Z29uIGNsYXNzPSJjbHMtMTIiIHBvaW50cz0iNDUuMzQ1IDIxLjYwNCA0NS4zNDUgNDQuOTg0IDU3LjIzMSA1Mi44NjQgNTcuMjMxIDY2LjI5NiA3Ny45NDkgODAuMDY0IDc3Ljk0OSA0My4yMTkgNDUuMzQ1IDIxLjYwNCIvPgogICAgICAgIDxnIGNsYXNzPSJjbHMtMiI+CiAgICAgICAgICA8Zz4KICAgICAgICAgICAgPGxpbmUgY2xhc3M9ImNscy0zIiB4MT0iMjQuNjQzOCIgeTE9Ijg2Ljk1NDQiIHgyPSIyNi4wMTU3IiB5Mj0iODUuNTUzMSIvPgogICAgICAgICAgICA8bGluZSBjbGFzcz0iY2xzLTEzIiB4MT0iMjkuODA0IiB5MT0iODEuNjgzNCIgeDI9IjYwLjM4MTEiIHkyPSI1MC40NDkyIi8+CiAgICAgICAgICAgIDxsaW5lIGNsYXNzPSJjbHMtMyIgeDE9IjYyLjI3NTIiIHkxPSI0OC41MTQzIiB4Mj0iNjMuNjQ3IiB5Mj0iNDcuMTEzIi8+CiAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgICAgIDxwb2x5Z29uIGNsYXNzPSJjbHMtNSIgcG9pbnRzPSIzNS4yNTUgODkuNjQ1IDE3LjczNiAxMDEuNDkyIDAgODkuOTYyIDE3LjUyNSA3OC4xMjEgMzUuMjU1IDg5LjY0NSIvPgogICAgICAgIDxwb2x5Z29uIGNsYXNzPSJjbHMtNyIgcG9pbnRzPSIxNy43MzYgMTAxLjQ5MiAxNy45MTUgMTIxLjQxNiAwLjE3OSAxMDkuODg3IDAgODkuOTYyIDE3LjczNiAxMDEuNDkyIi8+CiAgICAgICAgPGxpbmUgY2xhc3M9ImNscy02IiB4MT0iMjAuNTg0OSIgeTE9IjEwNS41MzA1IiB4Mj0iNjUuODc0OSIgeTI9IjE3MS4zNjgxIi8+CiAgICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy04IiBwb2ludHM9IjM1LjI1NSA4OS42NDUgMzUuNDM0IDEwOS41NjkgMTcuOTE1IDEyMS40MTYgMTcuNzM2IDEwMS40OTIgMzUuMjU1IDg5LjY0NSIvPgogICAgICAgIDxwb2x5Z29uIGNsYXNzPSJjbHMtMTQiIHBvaW50cz0iOTIuMzk0IDE3My44MTUgNzQuODc1IDE4NS42NjIgNTcuMTM5IDE3NC4xMzIgNzQuNjY0IDE2Mi4yOTEgOTIuMzk0IDE3My44MTUiLz4KICAgICAgICA8cG9seWdvbiBjbGFzcz0iY2xzLTE1IiBwb2ludHM9Ijc0Ljg3NSAxODUuNjYyIDc1LjA1NCAyMDUuNTg2IDU3LjMxOSAxOTQuMDU3IDU3LjEzOSAxNzQuMTMyIDc0Ljg3NSAxODUuNjYyIi8+CiAgICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy0xNiIgcG9pbnRzPSI5Mi4zOTQgMTczLjgxNSA5Mi41NzQgMTkzLjczOSA3NS4wNTQgMjA1LjU4NiA3NC44NzUgMTg1LjY2MiA5Mi4zOTQgMTczLjgxNSIvPgogICAgICA8L2c+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K" +- content: "\n# URI, UUID, and structures\n\nYou should be familiar with REST architecture\ + \ before writing an integration. Read this overview page to gain a good understanding\ + \ of Bitbucket's REST implementation.\n\n----\n**On this page**\n\n* [URI structure](#uri-structure)\n\ + * [HTTP methods](#http-methods)\n* [UUID](#uuid)\n * [User object and UUID](#userobj)\n\ + \ * [Repository object and UUID](#repo-obj)\n * [Team object and UUID](#teamobj)\n\ + * [Standard error repsponses](#stand-error)\n* [Standard ISO-8601 timestamps](#timestamp)\n\ + \n----\n\n\n## URI structure \n\nAll Bitbucket Cloud\ + \ requests start with the `https://api.bitbucket.org/2.0` prefix (for the 2.0\ + \ API) and `https://api.bitbucket.org/1.0` prefix (1.0 API).\n\nThe next segment\ + \ of the URI path depends on the endpoint of the request. For example, using the\ + \ curl command and the repositories endpoint you can list all the issues on Bitbucket's\ + \ tutorial repository:\n\n```\ncurl https://api.bitbucket.org/2.0/repositories/tutorials/tutorials.bitbucket.org\n\ + ```\nGiven a specific endpoint, you can then drill down to a particular aspect\ + \ or resource of that endpoint. The issues resource on a repository is an example:\n\ + \n```\ncurl https://api.bitbucket.org/1.0/repositories/tutorials/tutorials.bitbucket.org/issues\n\ + ```\n### HTTP methods \nA given endpoint or resource\ + \ has a series of actions (or methods) associated with it. The Bitbucket service\ + \ supports these standard HTTP methods:\n\n\n \n\ + \ \n \n \n \ + \ \n \n \n \n \n \n \n \n \n \n \n \n \ + \ \n \n \n \n\ + \ \n \n
CallDescription
GETRetrieves\ + \ information.
PUTUpdates\ + \ existing information.
POSTCreates new information.
DELETERemoves existing information.
\n\nFor example,\ + \ you can call use the POST action on the issues resource and create an issue\ + \ on the issue tracker.\n\n**Specifying content length**\n\nYou can get a `411\ + \ Length Required` response. If this happens, the API requires a Content-Length\ + \ header but the client is not sending it. You should add the header yourself,\ + \ for example using the curl client:\n\n```\ncurl -r PUT --header \"Content-Length:\ + \ 0\" -u user:pass https://api.bitbucket.org/1.0/emails/rap@atlassian.com\n```\n\ + ## Universally Unique Identifier \n\nUUID's provide a single\ + \ point of recognition for users, teams, and repositories. The UUID is distinct\ + \ from the username, team name, and repository name fields and remains the same\ + \ even when those fields change. For example when a user changes their username\ + \ or moves a repository you will need to modify calls which use those identifiers\ + \ but not if you are pointing to the UUID.\n\n### UUID examples and structure\n\ + \nUUID's work with both the 1.0 and 2.0 APIs for the user, team, and repository\ + \ objects. The following examples the following characters are replacements for\ + \ curly brackets: `%7B` replaces `{` and `%7D` replaces `}`. You will see this\ + \ structure in the following example sections.\n\n### User object and UUID \n\nWhen you make a call using either the username or the\ + \ UUID for that user the response is the same.\n\n**Call with username**:\n\n\ + ```\ncurl https://api.bitbucket.org/2.0/users/tutorials\n```\n\n***Call with UUID\ + \ for the user**:\n\n```\ncurl https://api.bitbucket.org/2.0/users/%7Bc788b2da-b7a2-404c-9e26-d3f077557007%7D\n\ + ```\n\n**Response**\n```JSON\n{\n \"username\": \"tutorials\",\n \"website\"\ + : \"https://tutorials.bitbucket.org/\",\n \"display_name\": \"tutorials account\"\ + ,\n \"uuid\": \"{c788b2da-b7a2-404c-9e26-d3f077557007}\",\n \"links\": {\n\ + \ \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/tutorials\"\ + \n },\n \"repositories\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/tutorials\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/tutorials\"\ + \n },\n \"followers\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/tutorials/followers\"\ + \n },\n \"avatar\": {\n \"href\": \"https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2013/Nov/25/tutorials-avatar-1563784409-6_avatar.png\"\ + \n },\n \"following\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/tutorials/following\"\ + \n }\n },\n \"created_on\": \"2011-12-20T16:34:07.132459+00:00\"\ + ,\n \"location\": \"Santa Monica, CA\",\n \"type\": \"user\"\n}\n```\n\n\ + ### Repository object and UUID \n\nOnce you have the\ + \ UUID for a repository you no longer need a username or team name to make the\ + \ API call so long as you use an empty field. This helps you resolve repositories\ + \ no matter if the username or team name changes.\n\n**Call with team name (1team)\ + \ and repository name (moxie)**:\n\n```\ncurl https://api.bitbucket.org/2.0/repositories/1team/moxie\n\ + ```\n**Call with UUID and empty field**:\n\n```\ncurl https://api.bitbucket.org/2.0/repositories/%7B%7D/%7B21fa9bf8-b5b2-4891-97ed-d590bad0f871%7D\n\ + ```\n\n**Call with UUID and teamname**:\n\n```\ncurl https://api.bitbucket.org/2.0/repositories/1team/%7B21fa9bf8-b5b2-4891-97ed-d590bad0f871%7D\n\ + ```\n\n**Response**\n\n```JSON\n{\n \"created_on\": \"2013-11-08T01:11:03.222520+00:00\"\ + ,\n \"description\": \"\",\n \"fork_policy\": \"allow_forks\",\n \"full_name\"\ + : \"1team/moxie\",\n \"has_issues\": false,\n \"has_wiki\": false,\n \ + \ \"is_private\": false,\n \"language\": \"\",\n \"links\": {\n \"\ + avatar\": {\n \"href\": \"https://bitbucket.org/1team/moxie/avatar/32/\"\ + \n },\n \"branches\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/1team/moxie/refs/branches\"\ + \n },\n \"clone\": [\n {\n \"href\": \"\ + https://bitbucket.org/1team/moxie.git\",\n \"name\": \"https\"\n\ + \ },\n {\n \"href\": \"ssh://git@bitbucket.org/1team/moxie.git\"\ + ,\n \"name\": \"ssh\"\n }\n ],\n \"commits\"\ + : {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/1team/moxie/commits\"\ + \n },\n \"downloads\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/1team/moxie/downloads\"\ + \n },\n \"forks\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/1team/moxie/forks\"\ + \n },\n \"hooks\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/1team/moxie/hooks\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/1team/moxie\"\ + \n },\n \"pullrequests\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/1team/moxie/pullrequests\"\ + \n },\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/1team/moxie\"\ + \n },\n \"tags\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/1team/moxie/refs/tags\"\ + \n },\n \"watchers\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/1team/moxie/watchers\"\ + \n }\n },\n \"name\": \"moxie\",\n \"owner\": {\n \"display_name\"\ + : \"the team\",\n \"links\": {\n \"avatar\": {\n \ + \ \"href\": \"https://bitbucket.org/account/1team/avatar/32/\"\n \ + \ },\n \"html\": {\n \"href\": \"https://bitbucket.org/1team/\"\ + \n },\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/teams/1team\"\ + \n }\n },\n \"type\": \"team\",\n \"username\"\ + : \"1team\",\n \"uuid\": \"{aa559944-83c9-4963-a9a8-69ac8d9cf5d2}\"\n \ + \ },\n \"project\": {\n \"key\": \"PROJ\",\n \"links\": {\n\ + \ \"avatar\": {\n \"href\": \"https://bitbucket.org/account/user/1team/projects/PROJ/avatar/32\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/account/user/1team/projects/PROJ\"\ + \n }\n },\n \"name\": \"Untitled project\",\n \ + \ \"type\": \"project\",\n \"uuid\": \"{ab52aaeb-16ad-4fb0-bb1d-47e4f00367ff}\"\ + \n },\n \"scm\": \"git\",\n \"size\": 33348,\n \"type\": \"repository\"\ + ,\n \"updated_on\": \"2013-11-08T01:11:03.263237+00:00\",\n \"uuid\": \"\ + {21fa9bf8-b5b2-4891-97ed-d590bad0f871}\",\n \"website\": \"\"\n}\n```\n\n###\ + \ Team object and UUID \n\nThis example shows a call for\ + \ a list of team members using both the team name and with the UUID for the team\ + \ object. As the call is unauthenticated in the following example the response\ + \ object will only show members with public profiles. The response is the same\ + \ in either case.\n\n**Call with teamname**\n\n```\ncurl https://api.bitbucket.org/2.0/teams/1team/members\n\ + ```\n**Call with UUID for team object**\n\n```\ncurl https://api.bitbucket.org/2.0/teams/%7Baa559944-83c9-4963-a9a8-69ac8d9cf5d2%7D/members\n\ + ```\n\n**Response**\n\n```JSON\n{\n \"page\": 1,\n \"pagelen\": 50,\n \ + \ \"size\": 2,\n \"values\": [\n {\n \"created_on\": \"\ + 2011-12-20T16:34:07.132459+00:00\",\n \"display_name\": \"tutorials\ + \ account\",\n \"links\": {\n \"avatar\": {\n \ + \ \"href\": \"https://bitbucket.org/account/tutorials/avatar/32/\"\ + \n },\n \"followers\": {\n \"\ + href\": \"https://api.bitbucket.org/2.0/users/tutorials/followers\"\n \ + \ },\n \"following\": {\n \"href\": \"\ + https://api.bitbucket.org/2.0/users/tutorials/following\"\n },\n\ + \ \"hooks\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/tutorials/hooks\"\ + \n },\n \"html\": {\n \"href\"\ + : \"https://bitbucket.org/tutorials/\"\n },\n \"\ + repositories\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/tutorials\"\ + \n },\n \"self\": {\n \"href\"\ + : \"https://api.bitbucket.org/2.0/users/tutorials\"\n },\n \ + \ \"snippets\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/tutorials\"\ + \n }\n },\n \"location\": null,\n \ + \ \"type\": \"user\",\n \"username\": \"tutorials\",\n \ + \ \"uuid\": \"{c788b2da-b7a2-404c-9e26-d3f077557007}\",\n \"website\"\ + : \"https://tutorials.bitbucket.org/\"\n },\n {\n \"\ + created_on\": \"2013-12-10T14:44:13+00:00\",\n \"display_name\": \"\ + Dan Stevens [Atlassian]\",\n \"links\": {\n \"avatar\"\ + : {\n \"href\": \"https://bitbucket.org/account/dans9190/avatar/32/\"\ + \n },\n \"followers\": {\n \"\ + href\": \"https://api.bitbucket.org/2.0/users/dans9190/followers\"\n \ + \ },\n \"following\": {\n \"href\": \"\ + https://api.bitbucket.org/2.0/users/dans9190/following\"\n },\n\ + \ \"hooks\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/dans9190/hooks\"\ + \n },\n \"html\": {\n \"href\"\ + : \"https://bitbucket.org/dans9190/\"\n },\n \"\ + repositories\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/dans9190\"\ + \n },\n \"self\": {\n \"href\"\ + : \"https://api.bitbucket.org/2.0/users/dans9190\"\n },\n \ + \ \"snippets\": {\n \"href\": \"https://api.bitbucket.org/2.0/snippets/dans9190\"\ + \n }\n },\n \"location\": null,\n \ + \ \"type\": \"user\",\n \"username\": \"dans9190\",\n \ + \ \"uuid\": \"{1cd06601-cd0e-4fce-be03-e9ac226978b7}\",\n \"website\"\ + : \"\"\n }\n ]\n}\n```\n\n## Standardized error responses \n\nThe 2.0 API standardizes the error response layout. The\ + \ 2.0 API serves a JSON\nobject along with the appropriate HTTP status code. The\ + \ JSON object provides a\ndetailed problem description.\n\n```json\n{\n \"\ + type\": \"error\",\n \"error\": {\n \"message\": \"Bad request\",\n\ + \ \"fields\": {\n \"src\": [\n \"This field is\ + \ required.\"\n ]\n },\n \"detail\": \"You must specify\ + \ a valid source branch when creating a pull request.\",\n \"id\": \"d23a1cc5178f7637f3d9bf2d13824258\"\ + ,\n \"data\": {\n \"extra\": \"Optional, endpoint-specific data\ + \ to further augment the error.\"\n }\n }\n}\n```\n\nThis object contains\ + \ an error element which contains the following nested\nelements:\n\n\n\ + \ \n \n \n \n\ + \ \n \n \n \n \n \n \n \n \ + \ \n\ + \ \n \n \n \n \n \ + \ \n \n \n\ + \ \n
ElementDescription
messageA\ + \ short description of the problem. This element is always present. Its value\ + \ may be localized.
fieldsThis optional element is used in response to POST or PUT operations in\ + \ which clients have provided invalid input. It contains a list of one or more\ + \ client-provided fields that failed validation. The values may be localized.
detailAn optional detailed\ + \ explanation of the failure. Its value may be localized.
idAn optional unique error identifier\ + \ that identifies the error in Bitbucket's logging system. If you feel you hit\ + \ a bug in an API and this field is provided, please mention it if you decide\ + \ to contact support as it will greatly help us narrow down the problem.
\n\n## Standard ISO-8601 timestamps \n\nAll 2.0 APIs use standardized ISO-8601 timestamps. In most cases, our\ + \ APIs return UTC timestamps and for these, the timezone offset part will be 00:00.\ + \ In rare cases where the original localized timestamp has significance, the timezone\ + \ offset may identify the event's original timezone.\n" + title: "URI, UUID, and structures" + description: "URL's, UUID's, errors, and timestamps" + key: "uri-uuid" + icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMTc5LjI2IDE3Ny42NSI+PGRlZnM+PHN0eWxlPi5jbHMtMXtmaWxsOnVybCgjbGluZWFyLWdyYWRpZW50KTt9LmNscy0ye2ZpbGw6IzA5MWU0Mjt9LmNscy0xMCwuY2xzLTExLC5jbHMtMywuY2xzLTQsLmNscy05e2ZpbGw6bm9uZTt9LmNscy0ze3N0cm9rZTojOTljMWZmO30uY2xzLTMsLmNscy00e3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6MDt9LmNscy0xMiwuY2xzLTQsLmNscy05e3N0cm9rZTojZTVlOGVjO30uY2xzLTV7ZmlsbDojMzQ0NTYzO30uY2xzLTZ7ZmlsbDojZmY4YjAwO30uY2xzLTd7ZmlsbDojZmZjNDAwO30uY2xzLTh7ZmlsbDojMDA2NWZmO30uY2xzLTEwLC5jbHMtMTEsLmNscy0xMiwuY2xzLTEzLC5jbHMtOXtzdHJva2UtbWl0ZXJsaW1pdDoxMDtzdHJva2Utd2lkdGg6MnB4O30uY2xzLTEwe3N0cm9rZTojZmZhYjAwO30uY2xzLTExLC5jbHMtMTN7c3Ryb2tlOiMwMDY1ZmY7fS5jbHMtMTJ7ZmlsbDojOTljMWZmO30uY2xzLTEze2ZpbGw6I2U1ZThlYzt9PC9zdHlsZT48bGluZWFyR3JhZGllbnQgaWQ9ImxpbmVhci1ncmFkaWVudCIgeDE9IjAuNCIgeTE9IjE3OC4wNSIgeDI9IjE3OC44NSIgeTI9Ii0wLjQiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwOTFlNDIiLz48c3RvcCBvZmZzZXQ9IjAuMDciIHN0b3AtY29sb3I9IiMwZDIyNDUiLz48c3RvcCBvZmZzZXQ9IjAuNDkiIHN0b3AtY29sb3I9IiMxZjMyNTMiLz48c3RvcCBvZmZzZXQ9IjAuNzkiIHN0b3AtY29sb3I9IiMyNTM4NTgiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48dGl0bGU+Q29kZTwvdGl0bGU+PGcgaWQ9IkxheWVyXzIiIGRhdGEtbmFtZT0iTGF5ZXIgMiI+PGcgaWQ9IlNvZnR3YXJlIj48cmVjdCBpZD0iX1JlY3RhbmdsZV8iIGRhdGEtbmFtZT0iJmx0O1JlY3RhbmdsZSZndDsiIGNsYXNzPSJjbHMtMSIgd2lkdGg9IjE3OS4yNiIgaGVpZ2h0PSIxNzcuNjUiLz48cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Ik0xNzkuMjYsMjYuNjRIMFY3MS43NUExNjYuNDEsMTY2LjQxLDAsMCwwLDYzLjI0LDU5LjUxYTE4OC40MSwxODguNDEsMCwwLDAsMTcuMzktOC4zNmMxOC40NC05LjQzLDQ4LjM3LTE3LjksOTguNjItMTNabS0xNTkuNDQsMzRoMFptMC0xNC4wOGgwWiIvPjxsaW5lIGNsYXNzPSJjbHMtMyIgeDE9IjE5LjgxIiB5MT0iNDYuNTgiIHgyPSIyNS4wNyIgeTI9IjQ2LjU4Ii8+PGxpbmUgY2xhc3M9ImNscy0zIiB4MT0iMjUuMDciIHkxPSI2MC42NiIgeDI9IjE5LjgxIiB5Mj0iNjAuNjYiLz48bGluZSBjbGFzcz0iY2xzLTMiIHgxPSIxOS44MSIgeTE9Ijc0Ljc0IiB4Mj0iMjUuMDciIHkyPSI3NC43NCIvPjxsaW5lIGNsYXNzPSJjbHMtMyIgeDE9IjI1LjA3IiB5MT0iODguODIiIHgyPSIxOS44MSIgeTI9Ijg4LjgyIi8+PGxpbmUgY2xhc3M9ImNscy0zIiB4MT0iMjUuMDciIHkxPSIxMDIuODkiIHgyPSIxOS44MSIgeTI9IjEwMi44OSIvPjxsaW5lIGNsYXNzPSJjbHMtMyIgeDE9IjI1LjA3IiB5MT0iMTE2Ljk3IiB4Mj0iMTkuODEiIHkyPSIxMTYuOTciLz48bGluZSBjbGFzcz0iY2xzLTMiIHgxPSIyNS4wNyIgeTE9IjEzMS4wNSIgeDI9IjE5LjgxIiB5Mj0iMTMxLjA1Ii8+PGxpbmUgY2xhc3M9ImNscy0zIiB4MT0iMjUuMDciIHkxPSIxNDUuMTMiIHgyPSIxOS44MSIgeTI9IjE0NS4xMyIvPjxsaW5lIGNsYXNzPSJjbHMtMyIgeDE9IjI1LjA3IiB5MT0iMTU5LjIxIiB4Mj0iMTkuODEiIHkyPSIxNTkuMjEiLz48bGluZSBjbGFzcz0iY2xzLTQiIHgxPSI1NS44OSIgeTE9IjEzMS4wNSIgeDI9IjkzLjk5IiB5Mj0iMTMxLjA1Ii8+PGxpbmUgY2xhc3M9ImNscy00IiB4MT0iNTUuODkiIHkxPSIxNDUuMTMiIHgyPSIxMzkuNjciIHkyPSIxNDUuMTMiLz48cmVjdCBjbGFzcz0iY2xzLTUiIHdpZHRoPSIxNzkuMjYiIGhlaWdodD0iMjYuNjQiLz48Y2lyY2xlIGNsYXNzPSJjbHMtNiIgY3g9IjEzLjUiIGN5PSIxMi4wOCIgcj0iNS4xMSIvPjxjaXJjbGUgY2xhc3M9ImNscy03IiBjeD0iMzAuMTgiIGN5PSIxMi4wOCIgcj0iNS4xMSIvPjxjaXJjbGUgY2xhc3M9ImNscy04IiBjeD0iNDYuODYiIGN5PSIxMi4wOCIgcj0iNS4xMSIvPjxwYXRoIGNsYXNzPSJjbHMtOSIgZD0iTTc1LjQxLDg4LjgyIi8+PHBhdGggY2xhc3M9ImNscy05IiBkPSJNMzIuODksODguODIiLz48bGluZSBjbGFzcz0iY2xzLTEwIiB4MT0iMzIuODkiIHkxPSI3NC43NCIgeDI9Ijc1LjQxIiB5Mj0iNzQuNzQiLz48bGluZSBjbGFzcz0iY2xzLTExIiB4MT0iMzIuODkiIHkxPSI2MC42NiIgeDI9Ijc1LjQxIiB5Mj0iNjAuNjYiLz48bGluZSBjbGFzcz0iY2xzLTkiIHgxPSIzMi44OSIgeTE9IjQ2LjU4IiB4Mj0iNTUuODkiIHkyPSI0Ni41OCIvPjxsaW5lIGNsYXNzPSJjbHMtMTIiIHgxPSIxOS44MSIgeTE9IjQ2LjU4IiB4Mj0iMjUuMDciIHkyPSI0Ni41OCIvPjxsaW5lIGNsYXNzPSJjbHMtMTIiIHgxPSIxOS44MSIgeTE9IjYwLjY2IiB4Mj0iMjUuMDciIHkyPSI2MC42NiIvPjxsaW5lIGNsYXNzPSJjbHMtMTIiIHgxPSIxOS44MSIgeTE9Ijc0Ljc0IiB4Mj0iMjUuMDciIHkyPSI3NC43NCIvPjxsaW5lIGNsYXNzPSJjbHMtMTIiIHgxPSIxOS44MSIgeTE9Ijg4LjgyIiB4Mj0iMjUuMDciIHkyPSI4OC44MiIvPjxsaW5lIGNsYXNzPSJjbHMtMTIiIHgxPSIxOS44MSIgeTE9IjEwMi44OSIgeDI9IjI1LjA3IiB5Mj0iMTAyLjg5Ii8+PGxpbmUgY2xhc3M9ImNscy0xMiIgeDE9IjE5LjgxIiB5MT0iMTE2Ljk3IiB4Mj0iMjUuMDciIHkyPSIxMTYuOTciLz48bGluZSBjbGFzcz0iY2xzLTEyIiB4MT0iMTkuODEiIHkxPSIxMzEuMDUiIHgyPSIyNS4wNyIgeTI9IjEzMS4wNSIvPjxsaW5lIGNsYXNzPSJjbHMtMTIiIHgxPSIxOS44MSIgeTE9IjE0NS4xMyIgeDI9IjI1LjA3IiB5Mj0iMTQ1LjEzIi8+PGxpbmUgY2xhc3M9ImNscy0xMiIgeDE9IjE5LjgxIiB5MT0iMTU5LjIxIiB4Mj0iMjUuMDciIHkyPSIxNTkuMjEiLz48bGluZSBpZD0iX0xpbmVfIiBkYXRhLW5hbWU9IiZsdDtMaW5lJmd0OyIgY2xhc3M9ImNscy0xMCIgeDE9Ijg0LjI0IiB5MT0iMTE2Ljk3IiB4Mj0iMTU2LjY1IiB5Mj0iMTE2Ljk3Ii8+PHBhdGggY2xhc3M9ImNscy05IiBkPSJNMzIuODksMTE3aDBaIi8+PGxpbmUgY2xhc3M9ImNscy0xMCIgeDE9IjEwMiIgeTE9IjEzMS4wNSIgeDI9IjE2My42MiIgeTI9IjEzMS4wNSIvPjxsaW5lIGNsYXNzPSJjbHMtMTMiIHgxPSI1NS44OSIgeTE9IjEzMS4wNSIgeDI9IjkzLjk5IiB5Mj0iMTMxLjA1Ii8+PGxpbmUgY2xhc3M9ImNscy0xMyIgeDE9IjU1Ljg5IiB5MT0iMTQ1LjEzIiB4Mj0iMTM5LjY3IiB5Mj0iMTQ1LjEzIi8+PGxpbmUgY2xhc3M9ImNscy05IiB4MT0iNzguOSIgeTE9IjE1OS4yMSIgeDI9IjExMy41MSIgeTI9IjE1OS4yMSIvPjxsaW5lIGNsYXNzPSJjbHMtOSIgeDE9IjU5LjYxIiB5MT0iODguODIiIHgyPSI5OS4zMyIgeTI9Ijg4LjgyIi8+PGxpbmUgY2xhc3M9ImNscy05IiB4MT0iNTkuNjEiIHkxPSIxMDIuODkiIHgyPSI5OS4zMyIgeTI9IjEwMi44OSIvPjxjaXJjbGUgY2xhc3M9ImNscy02IiBjeD0iMTMuNSIgY3k9IjEyLjA4IiByPSI1LjExIi8+PGNpcmNsZSBjbGFzcz0iY2xzLTciIGN4PSIzMC4xOCIgY3k9IjEyLjA4IiByPSI1LjExIi8+PGNpcmNsZSBjbGFzcz0iY2xzLTgiIGN4PSI0Ni44NiIgY3k9IjEyLjA4IiByPSI1LjExIi8+PC9nPjwvZz48L3N2Zz4=" +- content: "\n# Cors and hypermedia\n\nThis section describes [Cross-origin resource\ + \ sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) (CORS),\ + \ what content types we support in requests and responses, and hyperlinking resources\ + \ in each json responses.\n\n\n----\n**On this page**\n\n* [CORS](#cors)\n* [Supported\ + \ content types](#supported-content)\n* [Resource links](#resource-links)\n\n\ + ----\n\n## Cors \n\nThe Bitbucket API supports Cross-origin\ + \ resource sharing to allow requests for restricted resources across domains.\ + \ For more information you can refer to:\n\n* [Wikipedia article on CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)\n\ + * [W3C CORS recommendation](https://www.w3.org/TR/cors/)\n\nSending a general\ + \ request from the api to bitbucket.com:\n\n`curl -i https://api.bitbucket.org\ + \ -H \"origin: http://bitbucket.com\"`\n\nGives this result:\n\n HTTP/1.1 302\ + \ FOUND\n Server: nginx/1.6.2\n Vary: Cookie\n Cache-Control: max-age=900\n\ + \ Content-Type: text/html; charset=utf-8\n Strict-Transport-Security: max-age=31536000\n\ + \ Date: Tue, 21 Jun 2016 17:54:37 GMT\n Location: http://confluence.atlassian.com/x/IYBGDQ\n\ + \ X-Served-By: app-110\n X-Static-Version: 2c820eb0d2b3\n ETag: \"d41d8cd98f00b204e9800998ecf8427e\"\ + \n X-Content-Type-Options: nosniff\n X-Render-Time: 0.00379920005798\n \ + \ Connection: Keep-Alive\n X-Version: 2c820eb0d2b3\n X-Frame-Options:\ + \ SAMEORIGIN\n X-Request-Count: 383\n X-Cache-Info: cached\n Content-Length:\ + \ 0\n\nSending the same request with the CORS check -X OPTIONS in the call:\n\n\ + `curl -i https://api.bitbucket.org -H \"origin: http://bitbucket.com\" -X OPTIONS`\n\ + \nGives this result:\n\n HTTP/1.1 302 FOUND\n Server: nginx/1.6.2\n Vary:\ + \ Cookie\n Cache-Control: max-age=900\n Content-Type: text/html; charset=utf-8\n\ + \ Access-Control-Expose-Headers: Accept-Ranges, Content-Encoding, Content-Length,\ + \ Content-Type, ETag, Last-Modified\n Strict-Transport-Security: max-age=31536000\n\ + \ Date: Tue, 21 Jun 2016 18:04:30 GMT\n Access-Control-Max-Age: 86400\n\ + \ Location: http://confluence.atlassian.com/x/IYBGDQ\n X-Served-By: app-111\n\ + \ Access-Control-Allow-Origin: *\n X-Static-Version: 2c820eb0d2b3\n ETag:\ + \ \"d41d8cd98f00b204e9800998ecf8427e\"\n X-Content-Type-Options: nosniff\n\ + \ X-Render-Time: 0.00371098518372\n Connection: keep-alive\n X-Version:\ + \ 2c820eb0d2b3\n X-Frame-Options: SAMEORIGIN\n X-Request-Count: 357\n \ + \ Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS\n Access-Control-Allow-Headers:\ + \ Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match,\ + \ If-Unmodified-Since, Origin, Range, X-CsrftokenX-Requested-With\n X-Cache-Info:\ + \ not cacheable; request wasn't a GET or HEAD\n Content-Length: 0\n\n\n\n##\ + \ Supported content types \n\nThe default and\ + \ primary content type for 2.0 APIs is JSON. This applies both to responses from\ + \ the server and to the request bodies provided by the client.\n\nUnless documented\ + \ otherwise, whenever creating a new (POST) or modifying an existing (PUT) object,\ + \ your client must provide the object's normal representation. Not every object\ + \ element can be mutated. For example, a repository's created_on date is an auto-generated,\ + \ immutable field. Your client can omit immutable fields from a request body.\n\ + \nIn some cases, a resource might also accept regular application/x-www-url-form-encoded\ + \ POST and PUT bodies. Such bodies can be more convenient in scripts and command\ + \ line usage. Requests bodies can contain contain nested elements or they can\ + \ be flat (without nested elements). Clients can send flat request bodies as either\ + \ as application/json or as application/x-www-url-form-encoded. Nested objects\ + \ always require JSON.\n\n## Resource links \n\n\ + Every 2.0 object contains a links element that points to related resources or\ + \ alternate representations. Use links to quickly discover and traverse to related\ + \ objects. Links serve a \"self-documenting\" function for each endpoint. For\ + \ example, the following request for a specific user:\n\n\n`$ curl https://api.bitbucket.org/2.0/users/tutorials`\n\ + \n```json\n{\n \"username\": \"tutorials\",\n \"website\": \"https://tutorials.bitbucket.org/\"\ + ,\n \"display_name\": \"tutorials account\",\n \"uuid\": \"{c788b2da-b7a2-404c-9e26-d3f077557007}\"\ + ,\n \"links\": {\n \"self\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/tutorials\"\ + \n },\n \"repositories\": {\n \"href\": \"https://api.bitbucket.org/2.0/repositories/tutorials\"\ + \n },\n \"html\": {\n \"href\": \"https://bitbucket.org/tutorials\"\ + \n },\n \"followers\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/tutorials/followers\"\ + \n },\n \"avatar\": {\n \"href\": \"https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2013/Nov/25/tutorials-avatar-1563784409-6_avatar.png\"\ + \n },\n \"following\": {\n \"href\": \"https://api.bitbucket.org/2.0/users/tutorials/following\"\ + \n }\n },\n \"created_on\": \"2011-12-20T16:34:07.132459+00:00\"\ + ,\n \"location\": \"Santa Monica, CA\",\n \"type\": \"user\"\n}\n```\nLinks\ + \ can be actual REST API resources or they can be informational. In this example,\ + \ informative resources include the user's avatar and the HTML URL for the user's\ + \ Bitbucket account. Your client should avoid hardcoding an API's URL and instead\ + \ use the URLs returned in API responses.\n\nA link's key is its `rel` (relationship)\ + \ attribute and it contains a mandatory href element. For example, the following\ + \ link:\n\n```json\n\"self\": {\n \"href\": \"https://api.bitbucket.org/api/2.0/users/tutorials\"\ + \n}\n```\n\nThe rel for this link is self and the href is https://api.bitbucket.org/api/2.0/users/tutorials.\ + \ A single rel key can contain an list (array) of href objects. Your client should\ + \ anticipate that any rel key can contain one or more href objects.\n\nFinally,\ + \ links can also contain optional elements. Two common optional elements are the\ + \ name element and the title element. They are often used to disambiguate links\ + \ that share the same rel key. In the example below, the repository object that\ + \ contains a clone link with two href objects. Each object contains the optional\ + \ name element to clarify its use.\n\n```json\n\"links\": {\n \"self\": {\n \ + \ \"href\": \"https://api.bitbucket.org/2.0/repositories/evzijst/bitbucket\"\ + \n },\n \"clone\": [\n {\n \"href\": \"https://api.bitbucket.org/evzijst/bitbucket.git\"\ + ,\n \"name\": \"https\"\n },\n {\n \"href\": \"ssh://git@bitbucket.org/erik/bitbucket.git\"\ + ,\n \"name\": \"ssh\"\n }\n ],\n ...\n}\n```\nLinks can support [URI\ + \ Templates](https://tools.ietf.org/html/rfc6570); Those that do contain a `\"\ + templated\": \"true\"` element.\n" + title: "Cors and hypermedia" + description: "Learn about resources and linking" + key: "cors-hypermedia" + icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjM2LjYgMjE4LjQzIj48ZGVmcz48c3R5bGU+LmNscy0xe2lzb2xhdGlvbjppc29sYXRlO30uY2xzLTIsLmNscy0zLC5jbHMtNHtmaWxsOm5vbmU7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7c3Ryb2tlLW1pdGVybGltaXQ6MTA7c3Ryb2tlLXdpZHRoOjExcHg7fS5jbHMtMntzdHJva2U6dXJsKCNsaW5lYXItZ3JhZGllbnQpO30uY2xzLTN7c3Ryb2tlOnVybCgjTmV3X0dyYWRpZW50X1N3YXRjaF8xNCk7fS5jbHMtNHtzdHJva2U6dXJsKCNOZXdfR3JhZGllbnRfU3dhdGNoXzEpO30uY2xzLTV7ZmlsbDojNDI1MjZlO30uY2xzLTZ7ZmlsbDojZmY1NjMwO30uY2xzLTEwLC5jbHMtNywuY2xzLTh7bWl4LWJsZW5kLW1vZGU6bXVsdGlwbHk7fS5jbHMtN3tmaWxsOnVybCgjbGluZWFyLWdyYWRpZW50LTIpO30uY2xzLTh7ZmlsbDp1cmwoI2xpbmVhci1ncmFkaWVudC0zKTt9LmNscy05e2ZpbGw6IzAwNjVmZjt9LmNscy0xMHtmaWxsOnVybCgjbGluZWFyLWdyYWRpZW50LTQpO308L3N0eWxlPjxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50IiB5MT0iMTY3Ljg3IiB4Mj0iMTkxLjU2IiB5Mj0iMTY3Ljg3IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjNTA1Zjc5Ii8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjMzQ0NTYzIi8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgaWQ9Ik5ld19HcmFkaWVudF9Td2F0Y2hfMTQiIHgxPSIxMTIuODMiIHkxPSIxMzEuNzIiIHgyPSIyMzYuNiIgeTI9IjEzMS43MiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwNTJjYyIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzI2ODRmZiIvPjwvbGluZWFyR3JhZGllbnQ+PGxpbmVhckdyYWRpZW50IGlkPSJOZXdfR3JhZGllbnRfU3dhdGNoXzEiIHgxPSI0NS4wNiIgeTE9Ijg2LjY5IiB4Mj0iMTY4Ljg4IiB5Mj0iODYuNjkiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNkZTM1MGIiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmZjc0NTIiLz48L2xpbmVhckdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0ibGluZWFyLWdyYWRpZW50LTIiIHgxPSIzNDQ3LjkzIiB5MT0iLTkxOC43OSIgeDI9IjM0NTEuNCIgeTI9Ii0xMDMyLjc2IiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKC01NzIuMzggMzcwNC4yOSkgcm90YXRlKC02NC4zNCkiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9IjAuMzEiIHN0b3AtY29sb3I9IiNjMWM3ZDAiIHN0b3Atb3BhY2l0eT0iMCIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2MxYzdkMCIvPjwvbGluZWFyR3JhZGllbnQ+PGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtMyIgeDE9IjM1MDYuNiIgeTE9Ii03OTYuNjYiIHgyPSIzNTEwLjA3IiB5Mj0iLTkxMC42MyIgeGxpbms6aHJlZj0iI2xpbmVhci1ncmFkaWVudC0yIi8+PGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQtNCIgeDE9IjM1ODEuNjgiIHkxPSItOTA2LjgyIiB4Mj0iMzU4NS4xNiIgeTI9Ii0xMDIwLjc5IiB4bGluazpocmVmPSIjbGluZWFyLWdyYWRpZW50LTIiLz48L2RlZnM+PHRpdGxlPldlYmhvb2tzPC90aXRsZT48ZyBjbGFzcz0iY2xzLTEiPjxnIGlkPSJMYXllcl8yIiBkYXRhLW5hbWU9IkxheWVyIDIiPjxnIGlkPSJTb2Z0d2FyZSI+PHBhdGggY2xhc3M9ImNscy0yIiBkPSJNMTg2LjA2LDE2Ny44N0gxMTcuNzJBMjcuNTgsMjcuNTgsMCwwLDAsOTIuMjQsMTg1YTQ1LjA2LDQ1LjA2LDAsMSwxLTQxLjY4LTYyLjE5Ii8+PHBhdGggY2xhc3M9ImNscy0zIiBkPSJNMTE4LjMzLDUwLjUybDM0LjE1LDU5LjE4YTI3LjU5LDI3LjU5LDAsMCwwLDI3LjU4LDEzLjUxLDQ1LjA2LDQ1LjA2LDAsMSwxLTMzLDY3LjE5Ii8+PHBhdGggY2xhc3M9ImNscy00IiBkPSJNNTAuNTYsMTY3Ljg3bDM0LjE4LTU5LjE2YTI3LjU5LDI3LjU5LDAsMCwwLTIuMDktMzAuNjQsNDUuMDYsNDUuMDYsMCwxLDEsNzQuNy01Ii8+PHBhdGggY2xhc3M9ImNscy01IiBkPSJNMTg2LjA2LDE5OS42NmEzMS43OSwzMS43OSwwLDEsMSwzMS43OS0zMS43OUEzMS44MiwzMS44MiwwLDAsMSwxODYuMDYsMTk5LjY2WiIvPjxnIGlkPSJfR3JvdXBfIiBkYXRhLW5hbWU9IiZsdDtHcm91cCZndDsiPjxwYXRoIGNsYXNzPSJjbHMtNiIgZD0iTTQ5LjU2LDE5OS42NGEzMS43OSwzMS43OSwwLDEsMSwzMi43Ny0zMC43N0EzMS44MiwzMS44MiwwLDAsMSw0OS41NiwxOTkuNjRaIi8+PC9nPjxwYXRoIGNsYXNzPSJjbHMtNyIgZD0iTTU0LjEyLDE4MC4zNmE1OC45LDU4LjksMCwwLDAtMS41OS0xMS4yN3MtMi4zNS05LjQ0LTcuMzMtMTYuODNhNDMuODksNDMuODksMCwwLDAtMTEuNzMtMTEuMTcsMzEuNzcsMzEuNzcsMCwwLDAsMjkuMjgsNTYuMTNDNTguMjksMTkyLjQ0LDU0LjY4LDE4Ni45LDU0LjEyLDE4MC4zNloiLz48cGF0aCBjbGFzcz0iY2xzLTgiIGQ9Ik0xODkuNjIsMTgwLjM2QTU4LjksNTguOSwwLDAsMCwxODgsMTY5LjA4cy0yLjM1LTkuNDQtNy4zMy0xNi44M0E0My44OSw0My44OSwwLDAsMCwxNjksMTQxLjA4YTMxLjc3LDMxLjc3LDAsMCwwLDI5LjI4LDU2LjEzQzE5My43OSwxOTIuNDQsMTkwLjE4LDE4Ni45LDE4OS42MiwxODAuMzZaIi8+PGcgaWQ9Il9Hcm91cF8yIiBkYXRhLW5hbWU9IiZsdDtHcm91cCZndDsiPjxwYXRoIGNsYXNzPSJjbHMtOSIgZD0iTTg5LjksMzMuNzhhMzIuNDYsMzIuNDYsMCwxLDEsMTEuODgsNDQuMzRBMzIuNDksMzIuNDksMCwwLDEsODkuOSwzMy43OFoiLz48L2c+PHBhdGggY2xhc3M9ImNscy0xMCIgZD0iTTEyMi4yMyw2Ni4xM2E1OC45LDU4LjksMCwwLDAtMS41OS0xMS4yN3MtMi4zNS05LjQ0LTcuMzMtMTYuODNjLTMuMzctNS05LjA2LTkuNzktMTUuNDMtMTMuNDhBMzIuNDQsMzIuNDQsMCwwLDAsMTI4Ljc3LDgwLjZDMTI1LjMxLDc2LjM5LDEyMi43LDcxLjYxLDEyMi4yMyw2Ni4xM1oiLz48L2c+PC9nPjwvZz48L3N2Zz4=" +- content: "\n# Atlassian Connect for Bitbucket\n\nYou can use the Atlassian Connect\ + \ for Bitbucket Cloud to build add-ons which\ncan connect with the Bitbucket UI\ + \ and your own application set. An add-on could\nbe an integration with another\ + \ existing service, new features for the Atlassian\napplication, or even a new\ + \ product that runs within the Atlassian application.\n\nFor complete information\ + \ see:\n[Atlassian Connect for Bitbucket Cloud](https://developer.atlassian.com/bitbucket/index.html)\n" + title: "Atlassian Connect" + description: "Build Bitbucket add-ons with Connect" + key: "bb-connect" + icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjU3LjMxNjMgMTYyLjU5OTQiPgogIDxkZWZzPgogICAgPHN0eWxlPgogICAgICAuY2xzLTEgewogICAgICAgIGlzb2xhdGlvbjogaXNvbGF0ZTsKICAgICAgfQoKICAgICAgLmNscy0yIHsKICAgICAgICBmaWxsOiAjMzQ0NTYzOwogICAgICB9CgogICAgICAuY2xzLTMgewogICAgICAgIGZpbGw6ICMxZGI5ZDQ7CiAgICAgIH0KCiAgICAgIC5jbHMtNCB7CiAgICAgICAgZmlsbDogIzAwNTdkODsKICAgICAgfQoKICAgICAgLmNscy01LCAuY2xzLTcsIC5jbHMtOSB7CiAgICAgICAgbWl4LWJsZW5kLW1vZGU6IG11bHRpcGx5OwogICAgICB9CgogICAgICAuY2xzLTUgewogICAgICAgIGZpbGw6IHVybCgjTjc1KTsKICAgICAgfQoKICAgICAgLmNscy02IHsKICAgICAgICBmaWxsOiAjMDA2NWZmOwogICAgICB9CgogICAgICAuY2xzLTcgewogICAgICAgIGZpbGw6IHVybCgjTjc1LTIpOwogICAgICB9CgogICAgICAuY2xzLTggewogICAgICAgIGZpbGw6IHVybCgjbGluZWFyLWdyYWRpZW50KTsKICAgICAgfQoKICAgICAgLmNscy05IHsKICAgICAgICBmaWxsOiB1cmwoI043NS0zKTsKICAgICAgfQoKICAgICAgLmNscy0xMCB7CiAgICAgICAgZmlsbDogdXJsKCNUMjAwLVQ3NSk7CiAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9Ik43NSIgeDE9Ii0yMTg5LjU1NiIgeTE9IjI4MDguMjI4NCIgeDI9Ii0yMDkxLjE1NTEiIHkyPSIyODA4LjIyODQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMC4xNjgxLCAwLjk4NTgsIDAuOTg1OCwgLTAuMTY4MSwgLTIzNzMuNzM2LCAyNzIyLjEyNzgpIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iI2U1ZThlYyIvPgogICAgICA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNlNWU4ZWMiIHN0b3Atb3BhY2l0eT0iMC4xIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJONzUtMiIgZGF0YS1uYW1lPSJONzUiIHgxPSItMjE2OC41OTQ3IiB5MT0iMjkzNS4wNTU2IiB4Mj0iLTIwNzAuMTkzNyIgeTI9IjI5MzUuMDU1NiIgeGxpbms6aHJlZj0iI043NSIvPgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJsaW5lYXItZ3JhZGllbnQiIHgxPSIxOTAuMzU0NyIgeTE9IjE1OS45NjciIHgyPSIyNTkuOTQ4NyIgeTI9IjkwLjM3MyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgICA8c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMzNDQ1NjMiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjNWU2Yzg0Ii8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJONzUtMyIgZGF0YS1uYW1lPSJONzUiIHgxPSItMjI1Ny4zOTc3IiB5MT0iMjg4NC4yMjYzIiB4Mj0iLTIxNTguOTk2NyIgeTI9IjI4ODQuMjI2MyIgeGxpbms6aHJlZj0iI043NSIvPgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJUMjAwLVQ3NSIgeDE9IjEyNi4wMjU3IiB5MT0iODUuMTA4IiB4Mj0iMTk1LjYxOTciIHkyPSIxNS41MTQiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KICAgICAgPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjM2RjN2RjIi8+CiAgICAgIDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzljZTNlZSIvPgogICAgPC9saW5lYXJHcmFkaWVudD4KICA8L2RlZnM+CiAgPHRpdGxlPkFkZCBPbiBCbG9ja3MgMjwvdGl0bGU+CiAgPGcgY2xhc3M9ImNscy0xIj4KICAgIDxnIGlkPSJMYXllcl8yIiBkYXRhLW5hbWU9IkxheWVyIDIiPgogICAgICA8ZyBpZD0iT2JqZWN0cyI+CiAgICAgICAgPHJlY3QgaWQ9Il9SZWN0YW5nbGVfIiBkYXRhLW5hbWU9IiZsdDtSZWN0YW5nbGUmZ3Q7IiBjbGFzcz0iY2xzLTIiIHg9IjEyOC42NTgxIiB5PSI4Ny43NDA1IiB3aWR0aD0iNjQuMzI5MSIgaGVpZ2h0PSI3NC44NTkiLz4KICAgICAgICA8cmVjdCBpZD0iX1JlY3RhbmdsZV8yIiBkYXRhLW5hbWU9IiZsdDtSZWN0YW5nbGUmZ3Q7IiBjbGFzcz0iY2xzLTMiIHg9IjY0LjMyOTEiIHk9IjEyLjg4MTUiIHdpZHRoPSI2NC4zMjkxIiBoZWlnaHQ9Ijc0Ljg1OSIvPgogICAgICAgIDxyZWN0IGlkPSJfUmVjdGFuZ2xlXzMiIGRhdGEtbmFtZT0iJmx0O1JlY3RhbmdsZSZndDsiIGNsYXNzPSJjbHMtNCIgeT0iODcuNzQwNSIgd2lkdGg9IjY0LjMyOTEiIGhlaWdodD0iNzQuODU5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9ImNscy01IiBkPSJNNjQuMzI5MSw4Ny43NEg1OC42NTIzYTYyLjc4NzcsNjIuNzg3NywwLDAsMC0yNC41Njg0LDIwLjc2MjFjLTguMjYwNywxMi4xOTYtNC4zNDM3LDE4LjI0MTUtMTEuNjYzNywzMS42Mzk1QzE2LjUxLDE1MC45Niw4LjA1MSwxNTcuODIsMCwxNjIuNTU2di4wNDM1aDY0LjMyOVoiLz4KICAgICAgICA8cmVjdCBpZD0iX1JlY3RhbmdsZV80IiBkYXRhLW5hbWU9IiZsdDtSZWN0YW5nbGUmZ3Q7IiBjbGFzcz0iY2xzLTYiIHg9IjY0LjMyOTEiIHk9Ijg3Ljc0MDUiIHdpZHRoPSI2NC4zMjkxIiBoZWlnaHQ9Ijc0Ljg1OSIvPgogICAgICAgIDxwYXRoIGNsYXNzPSJjbHMtNyIgZD0iTTE5Mi45ODcyLDg3Ljc0SDE4My4zNDNhNjIuNzg3Nyw2Mi43ODc3LDAsMCwwLTI0LjU2ODQsMjAuNzYyMWMtOC4yNjA3LDEyLjE5Ni00LjM0MzgsMTguMjQxNS0xMS42NjM3LDMxLjYzOTVhNTYuNzI0Niw1Ni43MjQ2LDAsMCwxLTE4LjQ1MjcsMTkuOTF2Mi41NDc0aDY0LjMyOVoiLz4KICAgICAgICA8cmVjdCBjbGFzcz0iY2xzLTgiIHg9IjE5Mi45ODcyIiB5PSI4Ny43NDA1IiB3aWR0aD0iNjQuMzI5MSIgaGVpZ2h0PSI3NC44NTkiLz4KICAgICAgICA8cGF0aCBjbGFzcz0iY2xzLTkiIGQ9Ik0xMjguNjU4MiwxMi44ODE1SDExNi41OUE2MS45NjQ2LDYxLjk2NDYsMCwwLDAsMTAxLjMyMzMsMjguMjE1QzkzLjA2MjUsNDAuNDEwOSw5Ni45Nzk0LDQ2LjQ1NjUsODkuNjYsNTkuODU0NCw4My4wMzE2LDcxLjk4NTcsNzMuMTk3LDc5LjE1MTQsNjQuMzI5MSw4My45MTA4djMuODNoNjQuMzI5MVoiLz4KICAgICAgICA8cmVjdCBjbGFzcz0iY2xzLTEwIiB4PSIxMjguNjU4MSIgeT0iMTIuODgxNSIgd2lkdGg9IjY0LjMyOTEiIGhlaWdodD0iNzQuODU5Ii8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy00IiB4PSIxMC4xNjA1IiB5PSI3NC44NTkiIHdpZHRoPSIyNC43NTM2IiBoZWlnaHQ9IjEyLjg4MTUiLz4KICAgICAgICA8cmVjdCBjbGFzcz0iY2xzLTQiIHg9IjUxLjk1MjMiIHk9Ijc0Ljg1OSIgd2lkdGg9IjI0Ljc1MzYiIGhlaWdodD0iMTIuODgxNSIvPgogICAgICAgIDxyZWN0IGNsYXNzPSJjbHMtNCIgeD0iOTMuNzQ0MSIgeT0iNzQuODU5IiB3aWR0aD0iMjQuNzUzNiIgaGVpZ2h0PSIxMi44ODE1Ii8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy0yIiB4PSIxMzguODE4NiIgeT0iNzQuODU5IiB3aWR0aD0iMjQuNzUzNiIgaGVpZ2h0PSIxMi44ODE1Ii8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy0yIiB4PSIxODAuNjEwNCIgeT0iNzQuODU5IiB3aWR0aD0iMjQuNzUzNiIgaGVpZ2h0PSIxMi44ODE1Ii8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy0yIiB4PSIyMjIuNDAyMiIgeT0iNzQuODU5IiB3aWR0aD0iMjQuNzUzNiIgaGVpZ2h0PSIxMi44ODE1Ii8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy0zIiB4PSI3NC40ODk1IiB3aWR0aD0iMjQuNzUzNiIgaGVpZ2h0PSIxMi44ODE1Ii8+CiAgICAgICAgPHJlY3QgY2xhc3M9ImNscy0zIiB4PSIxMTYuMjgxNCIgd2lkdGg9IjI0Ljc1MzYiIGhlaWdodD0iMTIuODgxNSIvPgogICAgICAgIDxyZWN0IGNsYXNzPSJjbHMtMyIgeD0iMTU4LjA3MzIiIHdpZHRoPSIyNC43NTM2IiBoZWlnaHQ9IjEyLjg4MTUiLz4KICAgICAgPC9nPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==" +x-revision: "084db66c5834" diff --git a/api_client.go b/api_client.go new file mode 100644 index 0000000..cef8f07 --- /dev/null +++ b/api_client.go @@ -0,0 +1,463 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "bytes" + "encoding/json" + "encoding/xml" + "fmt" + "errors" + "io" + "mime/multipart" + "golang.org/x/oauth2" + "golang.org/x/net/context" + "net/http" + "net/url" + "time" + "os" + "path/filepath" + "reflect" + "regexp" + "strings" + "unicode/utf8" + "strconv" +) + +var ( + jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") + xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") +) + +// APIClient manages communication with the Bitbucket API API v2.0 +// 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 + AddonApi *AddonApiService + BranchrestrictionsApi *BranchrestrictionsApiService + CommitsApi *CommitsApiService + CommitstatusesApi *CommitstatusesApiService + DefaultApi *DefaultApiService + DownloadsApi *DownloadsApiService + IssueTrackerApi *IssueTrackerApiService + PipelinesApi *PipelinesApiService + ProjectsApi *ProjectsApiService + PullrequestsApi *PullrequestsApiService + RefsApi *RefsApiService + RepositoriesApi *RepositoriesApiService + SnippetsApi *SnippetsApiService + SourceApi *SourceApiService + SshApi *SshApiService + TeamsApi *TeamsApiService + UsersApi *UsersApiService + WebhooksApi *WebhooksApiService +} + +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.AddonApi = (*AddonApiService)(&c.common) + c.BranchrestrictionsApi = (*BranchrestrictionsApiService)(&c.common) + c.CommitsApi = (*CommitsApiService)(&c.common) + c.CommitstatusesApi = (*CommitstatusesApiService)(&c.common) + c.DefaultApi = (*DefaultApiService)(&c.common) + c.DownloadsApi = (*DownloadsApiService)(&c.common) + c.IssueTrackerApi = (*IssueTrackerApiService)(&c.common) + c.PipelinesApi = (*PipelinesApiService)(&c.common) + c.ProjectsApi = (*ProjectsApiService)(&c.common) + c.PullrequestsApi = (*PullrequestsApiService)(&c.common) + c.RefsApi = (*RefsApiService)(&c.common) + c.RepositoriesApi = (*RepositoriesApiService)(&c.common) + c.SnippetsApi = (*SnippetsApiService)(&c.common) + c.SourceApi = (*SourceApiService)(&c.common) + c.SshApi = (*SshApiService)(&c.common) + c.TeamsApi = (*TeamsApiService)(&c.common) + c.UsersApi = (*UsersApiService)(&c.common) + c.WebhooksApi = (*WebhooksApiService)(&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 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() + } + + // 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 +} + + +// 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 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) +} + diff --git a/api_response.go b/api_response.go new file mode 100644 index 0000000..3916ab3 --- /dev/null +++ b/api_response.go @@ -0,0 +1,44 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +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/author.go b/author.go new file mode 100644 index 0000000..b52b29b --- /dev/null +++ b/author.go @@ -0,0 +1,21 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type Author struct { + + Type_ string `json:"type"` + + // The raw author value from the repository. This may be the only value available if the author does not match a user in Bitbucket. + Raw string `json:"raw,omitempty"` + + User *Account `json:"user,omitempty"` +} diff --git a/base_commit.go b/base_commit.go new file mode 100644 index 0000000..f55b61d --- /dev/null +++ b/base_commit.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type BaseCommit struct { + + Type_ string `json:"type"` + + Hash string `json:"hash,omitempty"` + + Date time.Time `json:"date,omitempty"` + + Author *Author `json:"author,omitempty"` + + Message string `json:"message,omitempty"` + + Summary *PullrequestSummary `json:"summary,omitempty"` + + Parents []BaseCommit `json:"parents,omitempty"` +} diff --git a/branchrestriction.go b/branchrestriction.go new file mode 100644 index 0000000..2c41ba1 --- /dev/null +++ b/branchrestriction.go @@ -0,0 +1,31 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type Branchrestriction struct { + + Type_ string `json:"type"` + + Links *MilestoneLinks `json:"links,omitempty"` + + // The branch restriction status' id. + Id int32 `json:"id,omitempty"` + + // The type of restriction that is being applied + Kind string `json:"kind,omitempty"` + + Users []Account `json:"users,omitempty"` + + Groups []Group `json:"groups,omitempty"` + + // Value with kind-specific semantics: \"require_approvals_to_merge\" uses it to require a minimum number of approvals on a PR; \"require_passing_builds_to_merge\" uses it to require a minimum number of passing builds. + Value int32 `json:"value,omitempty"` +} diff --git a/branchrestrictions_api.go b/branchrestrictions_api.go new file mode 100644 index 0000000..bac5aa8 --- /dev/null +++ b/branchrestrictions_api.go @@ -0,0 +1,431 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type BranchrestrictionsApiService service + + +/* BranchrestrictionsApiService + Returns a paginated list of all branch restrictions on the repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return PaginatedBranchrestrictions*/ +func (a *BranchrestrictionsApiService) RepositoriesUsernameRepoSlugBranchRestrictionsGet(ctx context.Context, username string, repoSlug string) (PaginatedBranchrestrictions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedBranchrestrictions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/branch-restrictions" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* BranchrestrictionsApiService + Deletes an existing branch restriction rule. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param id The restriction rule's id + @return */ +func (a *BranchrestrictionsApiService) RepositoriesUsernameRepoSlugBranchRestrictionsIdDelete(ctx context.Context, username string, repoSlug 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 + "/repositories/{username}/{repo_slug}/branch-restrictions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* BranchrestrictionsApiService + Returns a specific branch restriction rule. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param id The restriction rule's id + @return Branchrestriction*/ +func (a *BranchrestrictionsApiService) RepositoriesUsernameRepoSlugBranchRestrictionsIdGet(ctx context.Context, username string, repoSlug string, id string) (Branchrestriction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Branchrestriction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/branch-restrictions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* BranchrestrictionsApiService + Updates an existing branch restriction rule. Fields not present in the request body are ignored. See [`POST`](../../branch-restrictions#post) for details. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param id The restriction rule's id + @param body The new version of the existing rule + @return Branchrestriction*/ +func (a *BranchrestrictionsApiService) RepositoriesUsernameRepoSlugBranchRestrictionsIdPut(ctx context.Context, username string, repoSlug string, id string, body Branchrestriction) (Branchrestriction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Branchrestriction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/branch-restrictions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + localVarPostBody = &body + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* BranchrestrictionsApiService + Creates a new branch restriction rule for a repository. `kind` describes what will be restricted. Allowed values are: `push`, `force`, `delete`, and `restrict_merges`. Different kinds of branch restrictions have different requirements: * `push` and `restrict_merges` require `users` and `groups` to be specified. Empty lists are allowed, in which case permission is denied for everybody. * `force` can not be specified in a Mercurial repository. `pattern` is used to determine which branches will be restricted. A `'*'` in `pattern` will expand to match zero or more characters, and every other character matches itself. For example, `'foo*'` will match `'foo'` and `'foobar'`, but not `'barfoo'`. `'*'` will match all branches. `users` and `groups` are lists of user names and group names. `kind` and `pattern` must be unique within a repository; adding new users or groups to an existing restriction should be done via `PUT`. Note that branch restrictions with overlapping patterns are allowed, but the resulting behavior may be surprising. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param body The new rule + @return Branchrestriction*/ +func (a *BranchrestrictionsApiService) RepositoriesUsernameRepoSlugBranchRestrictionsPost(ctx context.Context, username string, repoSlug string, body Branchrestriction) (Branchrestriction, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Branchrestriction + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/branch-restrictions" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/comment.go b/comment.go new file mode 100644 index 0000000..5a6fc32 --- /dev/null +++ b/comment.go @@ -0,0 +1,38 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Comment struct { + + Type_ string `json:"type"` + + Id int32 `json:"id,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + UpdatedOn time.Time `json:"updated_on,omitempty"` + + Content *PullrequestSummary `json:"content,omitempty"` + + User *User `json:"user,omitempty"` + + Deleted bool `json:"deleted,omitempty"` + + Parent *Comment `json:"parent,omitempty"` + + Inline *CommentInline `json:"inline,omitempty"` + + Links *CommentLinks `json:"links,omitempty"` +} diff --git a/comment_inline.go b/comment_inline.go new file mode 100644 index 0000000..125a9bb --- /dev/null +++ b/comment_inline.go @@ -0,0 +1,23 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type CommentInline struct { + + // The comment's anchor line in the new version of the file. + To int32 `json:"to,omitempty"` + + // The comment's anchor line in the old version of the file. + From int32 `json:"from,omitempty"` + + // The path of the file this comment is anchored to. + Path string `json:"path"` +} diff --git a/comment_links.go b/comment_links.go new file mode 100644 index 0000000..9f5268f --- /dev/null +++ b/comment_links.go @@ -0,0 +1,20 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type CommentLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Html *MilestoneLinksSelf `json:"html,omitempty"` + + Code *MilestoneLinksSelf `json:"code,omitempty"` +} diff --git a/commit.go b/commit.go new file mode 100644 index 0000000..e5e1ef3 --- /dev/null +++ b/commit.go @@ -0,0 +1,38 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Commit struct { + + Type_ string `json:"type"` + + Hash string `json:"hash,omitempty"` + + Date time.Time `json:"date,omitempty"` + + Author *Author `json:"author,omitempty"` + + Message string `json:"message,omitempty"` + + Summary *PullrequestSummary `json:"summary,omitempty"` + + Parents []BaseCommit `json:"parents,omitempty"` + + Links *CommitLinks `json:"links,omitempty"` + + Repository *Repository `json:"repository,omitempty"` + + Participants []Participant `json:"participants,omitempty"` +} diff --git a/commit_file.go b/commit_file.go new file mode 100644 index 0000000..30b4793 --- /dev/null +++ b/commit_file.go @@ -0,0 +1,24 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A file object, representing a file at a commit in a repository +type CommitFile struct { + + Type_ string `json:"type"` + + // The path in the repository + Path string `json:"path,omitempty"` + + Commit *Commit `json:"commit,omitempty"` + + Attributes string `json:"attributes,omitempty"` +} diff --git a/commit_links.go b/commit_links.go new file mode 100644 index 0000000..87e1566 --- /dev/null +++ b/commit_links.go @@ -0,0 +1,28 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type CommitLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Html *MilestoneLinksSelf `json:"html,omitempty"` + + Diff *MilestoneLinksSelf `json:"diff,omitempty"` + + Patch *MilestoneLinksSelf `json:"patch,omitempty"` + + Approve *MilestoneLinksSelf `json:"approve,omitempty"` + + Comments *MilestoneLinksSelf `json:"comments,omitempty"` + + Statuses *MilestoneLinksSelf `json:"statuses,omitempty"` +} diff --git a/commits_api.go b/commits_api.go new file mode 100644 index 0000000..364c56b --- /dev/null +++ b/commits_api.go @@ -0,0 +1,923 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type CommitsApiService service + + +/* CommitsApiService + Redact the authenticated user's approval of the specified commit. This operation is only available to users that have explicit access to the repository. In contrast, just the fact that a repository is publicly accessible to users does not give them the ability to approve commits. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param node The commit's SHA1. + @return */ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugCommitNodeApproveDelete(ctx context.Context, username string, repoSlug string, node 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 + "/repositories/{username}/{repo_slug}/commit/{node}/approve" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* CommitsApiService + Approve the specified commit as the authenticated user. This operation is only available to users that have explicit access to the repository. In contrast, just the fact that a repository is publicly accessible to users does not give them the ability to approve commits. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param node The commit's SHA1. + @return Participant*/ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugCommitNodeApprovePost(ctx context.Context, username string, repoSlug string, node string) (Participant, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Participant + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{node}/approve" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitsApiService + Returns the specified commit. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param revision The commit's SHA1. + @return Commit*/ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugCommitRevisionGet(ctx context.Context, username string, repoSlug string, revision string) (Commit, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Commit + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{revision}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"revision"+"}", fmt.Sprintf("%v", revision), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitsApiService + Returns the specified commit comment. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param sha + @param commentId + @param repoSlug + @return ModelError*/ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugCommitShaCommentsCommentIdGet(ctx context.Context, username string, sha string, commentId string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{sha}/comments/{comment_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sha"+"}", fmt.Sprintf("%v", sha), -1) + localVarPath = strings.Replace(localVarPath, "{"+"comment_id"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitsApiService + Returns the commit's comments. This includes both global and inline comments. The default sorting is oldest to newest and can be overridden with the `sort` query parameter. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param sha + @param repoSlug + @return ModelError*/ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugCommitShaCommentsGet(ctx context.Context, username string, sha string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{sha}/comments" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sha"+"}", fmt.Sprintf("%v", sha), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitsApiService + These are the repository's commits. They are paginated and returned in reverse chronological order, similar to the output of `git log` and `hg log`. Like these tools, the DAG can be filtered. ## GET /repositories/{username}/{repo_slug}/commits/ Returns all commits in the repo in topological order (newest commit first). All branches and tags are included (similar to `git log --all` and `hg log`). ## GET /repositories/{username}/{repo_slug}/commits/master Returns all commits on rev `master` (similar to `git log master`, `hg log master`). ## GET /repositories/{username}/{repo_slug}/commits/dev?exclude=master Returns all commits on ref `dev`, except those that are reachable on `master` (similar to `git log dev ^master`). ## GET /repositories/{username}/{repo_slug}/commits/?exclude=master Returns all commits in the repo that are not on master (similar to `git log --all ^master`). ## GET /repositories/{username}/{repo_slug}/commits/?include=foo&include=bar&exclude=fu&exclude=fubar Returns all commits that are on refs `foo` or `bar`, but not on `fu` or `fubar` (similar to `git log foo bar ^fu ^fubar`). Because the response could include a very large number of commits, it is paginated. Follow the 'next' link in the response to navigate to the next page of commits. As with other paginated resources, do not construct your own links. When the include and exclude parameters are more than can fit in a query string, clients can use a `x-www-form-urlencoded` POST instead. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return ModelError*/ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugCommitsGet(ctx context.Context, username string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commits" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitsApiService + Identical to `GET /repositories/{username}/{repo_slug}/commits`, except that POST allows clients to place the include and exclude parameters in the request body to avoid URL length issues. **Note that this resource does NOT support new commit creation.** + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return ModelError*/ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugCommitsPost(ctx context.Context, username string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commits" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitsApiService + These are the repository's commits. They are paginated and returned in reverse chronological order, similar to the output of `git log` and `hg log`. Like these tools, the DAG can be filtered. ## GET /repositories/{username}/{repo_slug}/commits/ Returns all commits in the repo in topological order (newest commit first). All branches and tags are included (similar to `git log --all` and `hg log`). ## GET /repositories/{username}/{repo_slug}/commits/master Returns all commits on rev `master` (similar to `git log master`, `hg log master`). ## GET /repositories/{username}/{repo_slug}/commits/dev?exclude=master Returns all commits on ref `dev`, except those that are reachable on `master` (similar to `git log dev ^master`). ## GET /repositories/{username}/{repo_slug}/commits/?exclude=master Returns all commits in the repo that are not on master (similar to `git log --all ^master`). ## GET /repositories/{username}/{repo_slug}/commits/?include=foo&include=bar&exclude=fu&exclude=fubar Returns all commits that are on refs `foo` or `bar`, but not on `fu` or `fubar` (similar to `git log foo bar ^fu ^fubar`). Because the response could include a very large number of commits, it is paginated. Follow the 'next' link in the response to navigate to the next page of commits. As with other paginated resources, do not construct your own links. When the include and exclude parameters are more than can fit in a query string, clients can use a `x-www-form-urlencoded` POST instead. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param revision + @param repoSlug + @return ModelError*/ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugCommitsRevisionGet(ctx context.Context, username string, revision string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commits/{revision}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"revision"+"}", fmt.Sprintf("%v", revision), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitsApiService + Identical to `GET /repositories/{username}/{repo_slug}/commits`, except that POST allows clients to place the include and exclude parameters in the request body to avoid URL length issues. **Note that this resource does NOT support new commit creation.** + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param revision + @param repoSlug + @return ModelError*/ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugCommitsRevisionPost(ctx context.Context, username string, revision string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commits/{revision}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"revision"+"}", fmt.Sprintf("%v", revision), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitsApiService + Produces a raw, git-style diff for either a single commit (diffed against its first parent), or a revspec of 2 commits (e.g. `3a8b42..9ff173` where the first commit represents the source and the second commit the destination). In case of the latter (diffing a revspec), a 3-way diff, or merge diff, is computed. This shows the changes introduced by the left branch (`3a8b42` in our example) as compared againt the right branch (`9ff173`). This is equivalent to merging the left branch into the right branch and then computing the diff of the merge commit against its first parent (the right branch). This follows the same behavior as pull requests that also show this style of 3-way, or merge diff. While similar to patches, diffs: * Don't have a commit header (username, commit message, etc) * Support the optional `path=foo/bar.py` query param to filter the diff to just that one file diff The raw diff is returned as-is, in whatever encoding the files in the repository use. It is not decoded into unicode. As such, the content-type is `text/plain`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param spec + @param repoSlug + @param optional (nil or map[string]interface{}) with one or more of: + @param "context" (int32) Generate diffs with <n> lines of context instead of the usual three + @param "path" (string) Limit the diff to a particular file (this parameter can be repeated for multiple paths) + @param "ignoreWhitespace" (bool) Generate diffs that ignore whitespace + @return */ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugDiffSpecGet(ctx context.Context, username string, spec string, repoSlug string, localVarOptionals map[string]interface{}) ( *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/diff/{spec}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spec"+"}", fmt.Sprintf("%v", spec), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["context"], "int32", "context"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["path"], "string", "path"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["ignoreWhitespace"], "bool", "ignoreWhitespace"); err != nil { + return nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["context"].(int32); localVarOk { + localVarQueryParams.Add("context", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["path"].(string); localVarOk { + localVarQueryParams.Add("path", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["ignoreWhitespace"].(bool); localVarOk { + localVarQueryParams.Add("ignore_whitespace", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* CommitsApiService + Produces a raw patch for a single commit (diffed against its first parent), or a patch-series for a revspec of 2 commits (e.g. `3a8b42..9ff173` where the first commit represents the source and the second commit the destination). In case of the latter (diffing a revspec), a patch series is returned for the commits on the source branch (`3a8b42` and its ancestors in our example). For Mercurial, a single patch is returned that combines the changes of all commits on the source branch. While similar to diffs, patches: * Have a commit header (username, commit message, etc) * Do not support the `path=foo/bar.py` query parameter The raw patch is returned as-is, in whatever encoding the files in the repository use. It is not decoded into unicode. As such, the content-type is `text/plain`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param spec + @param repoSlug + @return */ +func (a *CommitsApiService) RepositoriesUsernameRepoSlugPatchSpecGet(ctx context.Context, username string, spec string, repoSlug 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 + "/repositories/{username}/{repo_slug}/patch/{spec}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spec"+"}", fmt.Sprintf("%v", spec), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + diff --git a/commitstatus.go b/commitstatus.go new file mode 100644 index 0000000..b34948e --- /dev/null +++ b/commitstatus.go @@ -0,0 +1,47 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Commitstatus struct { + + Type_ string `json:"type"` + + Links *CommitstatusLinks `json:"links,omitempty"` + + // The commit status' id. + Uuid string `json:"uuid,omitempty"` + + // An identifier for the status that's unique to its type (current \"build\" is the only supported type) and the vendor, e.g. BB-DEPLOY + Key string `json:"key,omitempty"` + + // The name of the ref that pointed to this commit at the time the status object was created. Note that this the ref may since have moved off of the commit. This optional field can be useful for build systems whose build triggers and configuration are branch-dependent (e.g. a Pipeline build). It is legitimate for this field to not be set, or even apply (e.g. a static linting job). + Refname string `json:"refname,omitempty"` + + // A URL linking back to the vendor or build system, for providing more information about whatever process produced this status. Accepts context variables `repository` and `commit` that Bitbucket will evaluate at runtime whenever at runtime. For example, one could use https://foo.com/builds/{repository.full_name} which Bitbucket will turn into https://foo.com/builds/foo/bar at render time. + Url string `json:"url,omitempty"` + + // Provides some indication of the status of this commit + State string `json:"state,omitempty"` + + // An identifier for the build itself, e.g. BB-DEPLOY-1 + Name string `json:"name,omitempty"` + + // A description of the build (e.g. \"Unit tests in Bamboo\") + Description string `json:"description,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + UpdatedOn time.Time `json:"updated_on,omitempty"` +} diff --git a/commitstatus_links.go b/commitstatus_links.go new file mode 100644 index 0000000..6ea0095 --- /dev/null +++ b/commitstatus_links.go @@ -0,0 +1,18 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type CommitstatusLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Commit *MilestoneLinksSelf `json:"commit,omitempty"` +} diff --git a/commitstatuses_api.go b/commitstatuses_api.go new file mode 100644 index 0000000..99b8c2f --- /dev/null +++ b/commitstatuses_api.go @@ -0,0 +1,451 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type CommitstatusesApiService service + + +/* CommitstatusesApiService + Returns the specified build status for a commit. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param node The commit's SHA1 + @param key The build status' unique key + @return Commitstatus*/ +func (a *CommitstatusesApiService) RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet(ctx context.Context, username string, repoSlug string, node string, key string) (Commitstatus, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Commitstatus + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitstatusesApiService + Used to update the current status of a build status object on the specific commit. This operation can also be used to change other properties of the build status: * `state` * `name` * `description` * `url` * `refname` The `key` cannot be changed. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param node The commit's SHA1 + @param key The commit status' unique key + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (Commitstatus) The updated build status object + @return Commitstatus*/ +func (a *CommitstatusesApiService) RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut(ctx context.Context, username string, repoSlug string, node string, key string, localVarOptionals map[string]interface{}) (Commitstatus, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Commitstatus + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(Commitstatus); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitstatusesApiService + Creates a new build status against the specified commit. If the specified key already exists, the existing status object will be overwritten. When creating a new commit status, you can use a URI template for the URL. Templates are URLs that contain variable names that Bitbucket will evaluate at runtime whenever the URL is displayed anywhere similar to parameter substitution in [Bitbucket Connect](https://developer.atlassian.com/bitbucket/concepts/context-parameters.html). For example, one could use `https://foo.com/builds/{repository.full_name}` which Bitbucket will turn into `https://foo.com/builds/foo/bar` at render time. The context variables available are `repository` and `commit`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param node The commit's SHA1 + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (Commitstatus) The new commit status object. + @return Commitstatus*/ +func (a *CommitstatusesApiService) RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost(ctx context.Context, username string, repoSlug string, node string, localVarOptionals map[string]interface{}) (Commitstatus, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Commitstatus + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{node}/statuses/build" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(Commitstatus); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitstatusesApiService + Returns all statuses (e.g. build results) for a specific commit. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param node The commit's SHA1 + @return PaginatedCommitstatuses*/ +func (a *CommitstatusesApiService) RepositoriesUsernameRepoSlugCommitNodeStatusesGet(ctx context.Context, username string, repoSlug string, node string) (PaginatedCommitstatuses, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedCommitstatuses + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{node}/statuses" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* CommitstatusesApiService + Returns all statuses (e.g. build results) for the given pull request. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param pullRequestId The pull request's id + @return PaginatedCommitstatuses*/ +func (a *CommitstatusesApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet(ctx context.Context, username string, repoSlug string, pullRequestId int32) (PaginatedCommitstatuses, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedCommitstatuses + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/statuses" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/component.go b/component.go new file mode 100644 index 0000000..25343b2 --- /dev/null +++ b/component.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type Component struct { + + Type_ string `json:"type"` + + Links *MilestoneLinks `json:"links,omitempty"` + + Name string `json:"name,omitempty"` + + Id int32 `json:"id,omitempty"` +} diff --git a/config.json b/config.json new file mode 100644 index 0000000..c05ea8b --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +{ + "packageName": "bitbucket" +} diff --git a/configuration.go b/configuration.go new file mode 100644 index 0000000..23de538 --- /dev/null +++ b/configuration.go @@ -0,0 +1,73 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +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: "https://api.bitbucket.org/2.0", + 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 +} \ No newline at end of file diff --git a/default_api.go b/default_api.go new file mode 100644 index 0000000..7b9b541 --- /dev/null +++ b/default_api.go @@ -0,0 +1,596 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type DefaultApiService service + + +/* DefaultApiService + * @param ctx context.Context for authentication, logging, tracing, etc. + @return */ +func (a *DefaultApiService) RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameDelete(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 + "/repositories/{username}/{repo_slug}/properties/{app_key}/{property_name}" + + 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 + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* DefaultApiService + * @param ctx context.Context for authentication, logging, tracing, etc. + @return */ +func (a *DefaultApiService) RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameGet(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 + "/repositories/{username}/{repo_slug}/properties/{app_key}/{property_name}" + + 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 + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* DefaultApiService + * @param ctx context.Context for authentication, logging, tracing, etc. + @return */ +func (a *DefaultApiService) RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNamePut(ctx context.Context) ( *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/properties/{app_key}/{property_name}" + + 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 + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* DefaultApiService + Returns an object for each team permission a user on the team has. Permissions returned are effective permissions — if a user is a member of multiple groups with distinct roles, only the highest level is returned. Permissions can be: * `admin` * `collaborator` Only users with admin permission for the team may access this resource. Example: ``` $ curl https://api.bitbucket.org/2.0/teams/atlassian_tutorial/permissions { \"pagelen\": 10, \"values\": [ { \"permission\": \"admin\", \"type\": \"team_permission\", \"user\": { \"type\": \"user\", \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\" }, \"team\": { \"username\": \"bitbucket\", \"display_name\": \"Atlassian Bitbucket\", \"uuid\": \"{4cc6108a-a241-4db0-96a5-64347ac04f87}\" } }, { \"permission\": \"collaborator\", \"type\": \"team_permission\", \"user\": { \"type\": \"user\", \"username\": \"seanaty\", \"display_name\": \"Sean Conaty\", \"uuid\": \"{504c3b62-8120-4f0c-a7bc-87800b9d6f70}\" }, \"team\": { \"username\": \"bitbucket\", \"display_name\": \"Atlassian Bitbucket\", \"uuid\": \"{4cc6108a-a241-4db0-96a5-64347ac04f87}\" } } ], \"page\": 1, \"size\": 2 } ``` Results may be further [filtered or sorted](../../../meta/filtering) by team, user, or permission by adding the following query string parameters: * `q=user.username=\"evzijst\"` or `q=permission=\"admin\"` * `sort=team.display_name` Note that the query parameter values need to be URL escaped so that `=` would become `%3D`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the team, surrounded by curly-braces, for example: `{team UUID}`. + @param optional (nil or map[string]interface{}) with one or more of: + @param "q" (string) Query string to narrow down the response as per [filtering and sorting](../../../meta/filtering). + @param "sort" (string) Name of a response property sort the result by as per [filtering and sorting](../../../meta/filtering#query-sort). + @return PaginatedTeamPermissions*/ +func (a *DefaultApiService) TeamsUsernamePermissionsGet(ctx context.Context, username string, localVarOptionals map[string]interface{}) (PaginatedTeamPermissions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedTeamPermissions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/permissions" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["q"], "string", "q"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sort"], "string", "sort"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["q"].(string); localVarOk { + localVarQueryParams.Add("q", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sort"].(string); localVarOk { + localVarQueryParams.Add("sort", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* DefaultApiService + Returns an object for each repository permission for all of a team’s repositories. Permissions returned are effective permissions — the highest level of permission the user has. This does not include public repositories that users are not granted any specific permission in, and does not distinguish between direct and indirect privileges. Only users with admin permission for the team may access this resource. Permissions can be: * `admin` * `write` * `read` Example: ``` $ curl https://api.bitbucket.org/2.0/teams/atlassian_tutorial/permissions/repositories { \"pagelen\": 10, \"values\": [ { \"type\": \"repository_permission\", \"user\": { \"type\": \"user\", \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\" }, \"repository\": { \"type\": \"repository\", \"name\": \"geordi\", \"full_name\": \"bitbucket/geordi\", \"uuid\": \"{85d08b4e-571d-44e9-a507-fa476535aa98}\" }, \"permission\": \"admin\" }, { \"type\": \"repository_permission\", \"user\": { \"type\": \"user\", \"username\": \"seanaty\", \"display_name\": \"Sean Conaty\", \"uuid\": \"{504c3b62-8120-4f0c-a7bc-87800b9d6f70}\" }, \"repository\": { \"type\": \"repository\", \"name\": \"geordi\", \"full_name\": \"bitbucket/geordi\", \"uuid\": \"{85d08b4e-571d-44e9-a507-fa476535aa98}\" }, \"permission\": \"write\" } ], \"page\": 1, \"size\": 2 } ``` Results may be further [filtered or sorted](../../../../meta/filtering) by repository, user, or permission by adding the following query string parameters: * `q=repository.name=\"geordi\"` or `q=permission>\"read\"` * `sort=user.display_name` Note that the query parameter values need to be URL escaped so that `=` would become `%3D`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the team, surrounded by curly-braces, for example: `{team UUID}`. + @param optional (nil or map[string]interface{}) with one or more of: + @param "q" (string) Query string to narrow down the response as per [filtering and sorting](../../../../meta/filtering). + @param "sort" (string) Name of a response property sort the result by as per [filtering and sorting](../../../../meta/filtering#query-sort). + @return PaginatedRepositoryPermissions*/ +func (a *DefaultApiService) TeamsUsernamePermissionsRepositoriesGet(ctx context.Context, username string, localVarOptionals map[string]interface{}) (PaginatedRepositoryPermissions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedRepositoryPermissions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/permissions/repositories" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["q"], "string", "q"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sort"], "string", "sort"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["q"].(string); localVarOk { + localVarQueryParams.Add("q", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sort"].(string); localVarOk { + localVarQueryParams.Add("sort", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* DefaultApiService + * @param ctx context.Context for authentication, logging, tracing, etc. + @return SearchResult*/ +func (a *DefaultApiService) TeamsUsernameSearchCodeGet(ctx context.Context) (SearchResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload SearchResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/search/code" + + 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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* DefaultApiService + Returns an object for each team the caller is a member of, and their effective role — the highest level of privilege the caller has. If a user is a member of multiple groups with distinct roles, only the highest level is returned. Permissions can be: * `admin` * `collaborator` Example: ``` $ curl https://api.bitbucket.org/2.0/user/permissions/teams { \"pagelen\": 10, \"values\": [ { \"permission\": \"admin\", \"type\": \"team_permission\", \"user\": { \"type\": \"user\", \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\" }, \"team\": { \"username\": \"bitbucket\", \"display_name\": \"Atlassian Bitbucket\", \"uuid\": \"{4cc6108a-a241-4db0-96a5-64347ac04f87}\" } } ], \"page\": 1, \"size\": 1 } ``` Results may be further [filtered or sorted](../../../meta/filtering) by team or permission by adding the following query string parameters: * `q=team.username=\"bitbucket\"` or `q=permission=\"admin\"` * `sort=team.display_name` Note that the query parameter values need to be URL escaped so that `=` would become `%3D`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param optional (nil or map[string]interface{}) with one or more of: + @param "q" (string) Query string to narrow down the response as per [filtering and sorting](../../../meta/filtering). + @param "sort" (string) Name of a response property sort the result by as per [filtering and sorting](../../../meta/filtering#query-sort). + @return PaginatedTeamPermissions*/ +func (a *DefaultApiService) UserPermissionsTeamsGet(ctx context.Context, localVarOptionals map[string]interface{}) (PaginatedTeamPermissions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedTeamPermissions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user/permissions/teams" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["q"], "string", "q"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sort"], "string", "sort"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["q"].(string); localVarOk { + localVarQueryParams.Add("q", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sort"].(string); localVarOk { + localVarQueryParams.Add("sort", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* DefaultApiService + * @param ctx context.Context for authentication, logging, tracing, etc. + @return SearchResult*/ +func (a *DefaultApiService) UsersUsernameSearchCodeGet(ctx context.Context) (SearchResult, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload SearchResult + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/search/code" + + 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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/docs/Account.md b/docs/Account.md new file mode 100644 index 0000000..3f404b7 --- /dev/null +++ b/docs/Account.md @@ -0,0 +1,16 @@ +# Account + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***AccountLinks**](account_links.md) | | [optional] [default to null] +**Username** | **string** | | [optional] [default to null] +**DisplayName** | **string** | | [optional] [default to null] +**Website** | **string** | | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Uuid** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/AccountLinks.md b/docs/AccountLinks.md new file mode 100644 index 0000000..6c3b522 --- /dev/null +++ b/docs/AccountLinks.md @@ -0,0 +1,15 @@ +# AccountLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Html** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Avatar** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Followers** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Following** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Repositories** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/AddonApi.md b/docs/AddonApi.md new file mode 100644 index 0000000..4ff6c5f --- /dev/null +++ b/docs/AddonApi.md @@ -0,0 +1,286 @@ +# \AddonApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddonDelete**](AddonApi.md#AddonDelete) | **Delete** /addon | +[**AddonLinkersGet**](AddonApi.md#AddonLinkersGet) | **Get** /addon/linkers | +[**AddonLinkersLinkerKeyGet**](AddonApi.md#AddonLinkersLinkerKeyGet) | **Get** /addon/linkers/{linker_key} | +[**AddonLinkersLinkerKeyValuesDelete**](AddonApi.md#AddonLinkersLinkerKeyValuesDelete) | **Delete** /addon/linkers/{linker_key}/values | +[**AddonLinkersLinkerKeyValuesDelete_0**](AddonApi.md#AddonLinkersLinkerKeyValuesDelete_0) | **Delete** /addon/linkers/{linker_key}/values/ | +[**AddonLinkersLinkerKeyValuesGet**](AddonApi.md#AddonLinkersLinkerKeyValuesGet) | **Get** /addon/linkers/{linker_key}/values | +[**AddonLinkersLinkerKeyValuesGet_0**](AddonApi.md#AddonLinkersLinkerKeyValuesGet_0) | **Get** /addon/linkers/{linker_key}/values/ | +[**AddonLinkersLinkerKeyValuesPost**](AddonApi.md#AddonLinkersLinkerKeyValuesPost) | **Post** /addon/linkers/{linker_key}/values | +[**AddonLinkersLinkerKeyValuesPut**](AddonApi.md#AddonLinkersLinkerKeyValuesPut) | **Put** /addon/linkers/{linker_key}/values | +[**AddonPut**](AddonApi.md#AddonPut) | **Put** /addon | + + +# **AddonDelete** +> ModelError AddonDelete(ctx, ) + + + + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **AddonLinkersGet** +> ModelError AddonLinkersGet(ctx, ) + + + + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **AddonLinkersLinkerKeyGet** +> ModelError AddonLinkersLinkerKeyGet(ctx, linkerKey) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **linkerKey** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **AddonLinkersLinkerKeyValuesDelete** +> ModelError AddonLinkersLinkerKeyValuesDelete(ctx, linkerKey) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **linkerKey** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **AddonLinkersLinkerKeyValuesDelete_0** +> ModelError AddonLinkersLinkerKeyValuesDelete_0(ctx, linkerKey) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **linkerKey** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **AddonLinkersLinkerKeyValuesGet** +> ModelError AddonLinkersLinkerKeyValuesGet(ctx, linkerKey) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **linkerKey** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **AddonLinkersLinkerKeyValuesGet_0** +> ModelError AddonLinkersLinkerKeyValuesGet_0(ctx, linkerKey) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **linkerKey** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **AddonLinkersLinkerKeyValuesPost** +> ModelError AddonLinkersLinkerKeyValuesPost(ctx, linkerKey) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **linkerKey** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **AddonLinkersLinkerKeyValuesPut** +> ModelError AddonLinkersLinkerKeyValuesPut(ctx, linkerKey) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **linkerKey** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **AddonPut** +> ModelError AddonPut(ctx, ) + + + + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Author.md b/docs/Author.md new file mode 100644 index 0000000..bf980f3 --- /dev/null +++ b/docs/Author.md @@ -0,0 +1,12 @@ +# Author + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Raw** | **string** | The raw author value from the repository. This may be the only value available if the author does not match a user in Bitbucket. | [optional] [default to null] +**User** | [***Account**](account.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BaseCommit.md b/docs/BaseCommit.md new file mode 100644 index 0000000..b254368 --- /dev/null +++ b/docs/BaseCommit.md @@ -0,0 +1,16 @@ +# BaseCommit + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Hash** | **string** | | [optional] [default to null] +**Date** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Author** | [***Author**](author.md) | | [optional] [default to null] +**Message** | **string** | | [optional] [default to null] +**Summary** | [***PullrequestSummary**](pullrequest_summary.md) | | [optional] [default to null] +**Parents** | [**[]BaseCommit**](base_commit.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Branchrestriction.md b/docs/Branchrestriction.md new file mode 100644 index 0000000..eeed057 --- /dev/null +++ b/docs/Branchrestriction.md @@ -0,0 +1,16 @@ +# Branchrestriction + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***MilestoneLinks**](milestone_links.md) | | [optional] [default to null] +**Id** | **int32** | The branch restriction status' id. | [optional] [default to null] +**Kind** | **string** | The type of restriction that is being applied | [optional] [default to null] +**Users** | [**[]Account**](account.md) | | [optional] [default to null] +**Groups** | [**[]Group**](group.md) | | [optional] [default to null] +**Value** | **int32** | Value with kind-specific semantics: \"require_approvals_to_merge\" uses it to require a minimum number of approvals on a PR; \"require_passing_builds_to_merge\" uses it to require a minimum number of passing builds. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/BranchrestrictionsApi.md b/docs/BranchrestrictionsApi.md new file mode 100644 index 0000000..3378a82 --- /dev/null +++ b/docs/BranchrestrictionsApi.md @@ -0,0 +1,163 @@ +# \BranchrestrictionsApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**RepositoriesUsernameRepoSlugBranchRestrictionsGet**](BranchrestrictionsApi.md#RepositoriesUsernameRepoSlugBranchRestrictionsGet) | **Get** /repositories/{username}/{repo_slug}/branch-restrictions | +[**RepositoriesUsernameRepoSlugBranchRestrictionsIdDelete**](BranchrestrictionsApi.md#RepositoriesUsernameRepoSlugBranchRestrictionsIdDelete) | **Delete** /repositories/{username}/{repo_slug}/branch-restrictions/{id} | +[**RepositoriesUsernameRepoSlugBranchRestrictionsIdGet**](BranchrestrictionsApi.md#RepositoriesUsernameRepoSlugBranchRestrictionsIdGet) | **Get** /repositories/{username}/{repo_slug}/branch-restrictions/{id} | +[**RepositoriesUsernameRepoSlugBranchRestrictionsIdPut**](BranchrestrictionsApi.md#RepositoriesUsernameRepoSlugBranchRestrictionsIdPut) | **Put** /repositories/{username}/{repo_slug}/branch-restrictions/{id} | +[**RepositoriesUsernameRepoSlugBranchRestrictionsPost**](BranchrestrictionsApi.md#RepositoriesUsernameRepoSlugBranchRestrictionsPost) | **Post** /repositories/{username}/{repo_slug}/branch-restrictions | + + +# **RepositoriesUsernameRepoSlugBranchRestrictionsGet** +> PaginatedBranchrestrictions RepositoriesUsernameRepoSlugBranchRestrictionsGet(ctx, username, repoSlug) + + +Returns a paginated list of all branch restrictions on the repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**PaginatedBranchrestrictions**](paginated_branchrestrictions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugBranchRestrictionsIdDelete** +> RepositoriesUsernameRepoSlugBranchRestrictionsIdDelete(ctx, username, repoSlug, id) + + +Deletes an existing branch restriction rule. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **id** | **string**| The restriction rule's id | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugBranchRestrictionsIdGet** +> Branchrestriction RepositoriesUsernameRepoSlugBranchRestrictionsIdGet(ctx, username, repoSlug, id) + + +Returns a specific branch restriction rule. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **id** | **string**| The restriction rule's id | + +### Return type + +[**Branchrestriction**](branchrestriction.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugBranchRestrictionsIdPut** +> Branchrestriction RepositoriesUsernameRepoSlugBranchRestrictionsIdPut(ctx, username, repoSlug, id, body) + + +Updates an existing branch restriction rule. Fields not present in the request body are ignored. See [`POST`](../../branch-restrictions#post) for details. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **id** | **string**| The restriction rule's id | + **body** | [**Branchrestriction**](Branchrestriction.md)| The new version of the existing rule | + +### Return type + +[**Branchrestriction**](branchrestriction.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugBranchRestrictionsPost** +> Branchrestriction RepositoriesUsernameRepoSlugBranchRestrictionsPost(ctx, username, repoSlug, body) + + +Creates a new branch restriction rule for a repository. `kind` describes what will be restricted. Allowed values are: `push`, `force`, `delete`, and `restrict_merges`. Different kinds of branch restrictions have different requirements: * `push` and `restrict_merges` require `users` and `groups` to be specified. Empty lists are allowed, in which case permission is denied for everybody. * `force` can not be specified in a Mercurial repository. `pattern` is used to determine which branches will be restricted. A `'*'` in `pattern` will expand to match zero or more characters, and every other character matches itself. For example, `'foo*'` will match `'foo'` and `'foobar'`, but not `'barfoo'`. `'*'` will match all branches. `users` and `groups` are lists of user names and group names. `kind` and `pattern` must be unique within a repository; adding new users or groups to an existing restriction should be done via `PUT`. Note that branch restrictions with overlapping patterns are allowed, but the resulting behavior may be surprising. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **body** | [**Branchrestriction**](Branchrestriction.md)| The new rule | + +### Return type + +[**Branchrestriction**](branchrestriction.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Comment.md b/docs/Comment.md new file mode 100644 index 0000000..63273f2 --- /dev/null +++ b/docs/Comment.md @@ -0,0 +1,19 @@ +# Comment + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Id** | **int32** | | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**UpdatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Content** | [***PullrequestSummary**](pullrequest_summary.md) | | [optional] [default to null] +**User** | [***User**](user.md) | | [optional] [default to null] +**Deleted** | **bool** | | [optional] [default to null] +**Parent** | [***Comment**](comment.md) | | [optional] [default to null] +**Inline** | [***CommentInline**](comment_inline.md) | | [optional] [default to null] +**Links** | [***CommentLinks**](comment_links.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CommentInline.md b/docs/CommentInline.md new file mode 100644 index 0000000..4a40314 --- /dev/null +++ b/docs/CommentInline.md @@ -0,0 +1,12 @@ +# CommentInline + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**To** | **int32** | The comment's anchor line in the new version of the file. | [optional] [default to null] +**From** | **int32** | The comment's anchor line in the old version of the file. | [optional] [default to null] +**Path** | **string** | The path of the file this comment is anchored to. | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CommentLinks.md b/docs/CommentLinks.md new file mode 100644 index 0000000..37aaff9 --- /dev/null +++ b/docs/CommentLinks.md @@ -0,0 +1,12 @@ +# CommentLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Html** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Code** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Commit.md b/docs/Commit.md new file mode 100644 index 0000000..5f96854 --- /dev/null +++ b/docs/Commit.md @@ -0,0 +1,19 @@ +# Commit + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Hash** | **string** | | [optional] [default to null] +**Date** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Author** | [***Author**](author.md) | | [optional] [default to null] +**Message** | **string** | | [optional] [default to null] +**Summary** | [***PullrequestSummary**](pullrequest_summary.md) | | [optional] [default to null] +**Parents** | [**[]BaseCommit**](base_commit.md) | | [optional] [default to null] +**Links** | [***CommitLinks**](commit_links.md) | | [optional] [default to null] +**Repository** | [***Repository**](repository.md) | | [optional] [default to null] +**Participants** | [**[]Participant**](participant.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CommitFile.md b/docs/CommitFile.md new file mode 100644 index 0000000..778b765 --- /dev/null +++ b/docs/CommitFile.md @@ -0,0 +1,13 @@ +# CommitFile + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Path** | **string** | The path in the repository | [optional] [default to null] +**Commit** | [***Commit**](commit.md) | | [optional] [default to null] +**Attributes** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CommitLinks.md b/docs/CommitLinks.md new file mode 100644 index 0000000..68203f3 --- /dev/null +++ b/docs/CommitLinks.md @@ -0,0 +1,16 @@ +# CommitLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Html** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Diff** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Patch** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Approve** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Comments** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Statuses** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CommitsApi.md b/docs/CommitsApi.md new file mode 100644 index 0000000..834229e --- /dev/null +++ b/docs/CommitsApi.md @@ -0,0 +1,361 @@ +# \CommitsApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**RepositoriesUsernameRepoSlugCommitNodeApproveDelete**](CommitsApi.md#RepositoriesUsernameRepoSlugCommitNodeApproveDelete) | **Delete** /repositories/{username}/{repo_slug}/commit/{node}/approve | +[**RepositoriesUsernameRepoSlugCommitNodeApprovePost**](CommitsApi.md#RepositoriesUsernameRepoSlugCommitNodeApprovePost) | **Post** /repositories/{username}/{repo_slug}/commit/{node}/approve | +[**RepositoriesUsernameRepoSlugCommitRevisionGet**](CommitsApi.md#RepositoriesUsernameRepoSlugCommitRevisionGet) | **Get** /repositories/{username}/{repo_slug}/commit/{revision} | +[**RepositoriesUsernameRepoSlugCommitShaCommentsCommentIdGet**](CommitsApi.md#RepositoriesUsernameRepoSlugCommitShaCommentsCommentIdGet) | **Get** /repositories/{username}/{repo_slug}/commit/{sha}/comments/{comment_id} | +[**RepositoriesUsernameRepoSlugCommitShaCommentsGet**](CommitsApi.md#RepositoriesUsernameRepoSlugCommitShaCommentsGet) | **Get** /repositories/{username}/{repo_slug}/commit/{sha}/comments | +[**RepositoriesUsernameRepoSlugCommitsGet**](CommitsApi.md#RepositoriesUsernameRepoSlugCommitsGet) | **Get** /repositories/{username}/{repo_slug}/commits | +[**RepositoriesUsernameRepoSlugCommitsPost**](CommitsApi.md#RepositoriesUsernameRepoSlugCommitsPost) | **Post** /repositories/{username}/{repo_slug}/commits | +[**RepositoriesUsernameRepoSlugCommitsRevisionGet**](CommitsApi.md#RepositoriesUsernameRepoSlugCommitsRevisionGet) | **Get** /repositories/{username}/{repo_slug}/commits/{revision} | +[**RepositoriesUsernameRepoSlugCommitsRevisionPost**](CommitsApi.md#RepositoriesUsernameRepoSlugCommitsRevisionPost) | **Post** /repositories/{username}/{repo_slug}/commits/{revision} | +[**RepositoriesUsernameRepoSlugDiffSpecGet**](CommitsApi.md#RepositoriesUsernameRepoSlugDiffSpecGet) | **Get** /repositories/{username}/{repo_slug}/diff/{spec} | +[**RepositoriesUsernameRepoSlugPatchSpecGet**](CommitsApi.md#RepositoriesUsernameRepoSlugPatchSpecGet) | **Get** /repositories/{username}/{repo_slug}/patch/{spec} | + + +# **RepositoriesUsernameRepoSlugCommitNodeApproveDelete** +> RepositoriesUsernameRepoSlugCommitNodeApproveDelete(ctx, username, repoSlug, node) + + +Redact the authenticated user's approval of the specified commit. This operation is only available to users that have explicit access to the repository. In contrast, just the fact that a repository is publicly accessible to users does not give them the ability to approve commits. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitNodeApprovePost** +> Participant RepositoriesUsernameRepoSlugCommitNodeApprovePost(ctx, username, repoSlug, node) + + +Approve the specified commit as the authenticated user. This operation is only available to users that have explicit access to the repository. In contrast, just the fact that a repository is publicly accessible to users does not give them the ability to approve commits. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1. | + +### Return type + +[**Participant**](participant.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitRevisionGet** +> Commit RepositoriesUsernameRepoSlugCommitRevisionGet(ctx, username, repoSlug, revision) + + +Returns the specified commit. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **revision** | **string**| The commit's SHA1. | + +### Return type + +[**Commit**](commit.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitShaCommentsCommentIdGet** +> ModelError RepositoriesUsernameRepoSlugCommitShaCommentsCommentIdGet(ctx, username, sha, commentId, repoSlug) + + +Returns the specified commit comment. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **sha** | **string**| | + **commentId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitShaCommentsGet** +> ModelError RepositoriesUsernameRepoSlugCommitShaCommentsGet(ctx, username, sha, repoSlug) + + +Returns the commit's comments. This includes both global and inline comments. The default sorting is oldest to newest and can be overridden with the `sort` query parameter. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **sha** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitsGet** +> ModelError RepositoriesUsernameRepoSlugCommitsGet(ctx, username, repoSlug) + + +These are the repository's commits. They are paginated and returned in reverse chronological order, similar to the output of `git log` and `hg log`. Like these tools, the DAG can be filtered. ## GET /repositories/{username}/{repo_slug}/commits/ Returns all commits in the repo in topological order (newest commit first). All branches and tags are included (similar to `git log --all` and `hg log`). ## GET /repositories/{username}/{repo_slug}/commits/master Returns all commits on rev `master` (similar to `git log master`, `hg log master`). ## GET /repositories/{username}/{repo_slug}/commits/dev?exclude=master Returns all commits on ref `dev`, except those that are reachable on `master` (similar to `git log dev ^master`). ## GET /repositories/{username}/{repo_slug}/commits/?exclude=master Returns all commits in the repo that are not on master (similar to `git log --all ^master`). ## GET /repositories/{username}/{repo_slug}/commits/?include=foo&include=bar&exclude=fu&exclude=fubar Returns all commits that are on refs `foo` or `bar`, but not on `fu` or `fubar` (similar to `git log foo bar ^fu ^fubar`). Because the response could include a very large number of commits, it is paginated. Follow the 'next' link in the response to navigate to the next page of commits. As with other paginated resources, do not construct your own links. When the include and exclude parameters are more than can fit in a query string, clients can use a `x-www-form-urlencoded` POST instead. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitsPost** +> ModelError RepositoriesUsernameRepoSlugCommitsPost(ctx, username, repoSlug) + + +Identical to `GET /repositories/{username}/{repo_slug}/commits`, except that POST allows clients to place the include and exclude parameters in the request body to avoid URL length issues. **Note that this resource does NOT support new commit creation.** + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitsRevisionGet** +> ModelError RepositoriesUsernameRepoSlugCommitsRevisionGet(ctx, username, revision, repoSlug) + + +These are the repository's commits. They are paginated and returned in reverse chronological order, similar to the output of `git log` and `hg log`. Like these tools, the DAG can be filtered. ## GET /repositories/{username}/{repo_slug}/commits/ Returns all commits in the repo in topological order (newest commit first). All branches and tags are included (similar to `git log --all` and `hg log`). ## GET /repositories/{username}/{repo_slug}/commits/master Returns all commits on rev `master` (similar to `git log master`, `hg log master`). ## GET /repositories/{username}/{repo_slug}/commits/dev?exclude=master Returns all commits on ref `dev`, except those that are reachable on `master` (similar to `git log dev ^master`). ## GET /repositories/{username}/{repo_slug}/commits/?exclude=master Returns all commits in the repo that are not on master (similar to `git log --all ^master`). ## GET /repositories/{username}/{repo_slug}/commits/?include=foo&include=bar&exclude=fu&exclude=fubar Returns all commits that are on refs `foo` or `bar`, but not on `fu` or `fubar` (similar to `git log foo bar ^fu ^fubar`). Because the response could include a very large number of commits, it is paginated. Follow the 'next' link in the response to navigate to the next page of commits. As with other paginated resources, do not construct your own links. When the include and exclude parameters are more than can fit in a query string, clients can use a `x-www-form-urlencoded` POST instead. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **revision** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitsRevisionPost** +> ModelError RepositoriesUsernameRepoSlugCommitsRevisionPost(ctx, username, revision, repoSlug) + + +Identical to `GET /repositories/{username}/{repo_slug}/commits`, except that POST allows clients to place the include and exclude parameters in the request body to avoid URL length issues. **Note that this resource does NOT support new commit creation.** + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **revision** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugDiffSpecGet** +> RepositoriesUsernameRepoSlugDiffSpecGet(ctx, username, spec, repoSlug, optional) + + +Produces a raw, git-style diff for either a single commit (diffed against its first parent), or a revspec of 2 commits (e.g. `3a8b42..9ff173` where the first commit represents the source and the second commit the destination). In case of the latter (diffing a revspec), a 3-way diff, or merge diff, is computed. This shows the changes introduced by the left branch (`3a8b42` in our example) as compared againt the right branch (`9ff173`). This is equivalent to merging the left branch into the right branch and then computing the diff of the merge commit against its first parent (the right branch). This follows the same behavior as pull requests that also show this style of 3-way, or merge diff. While similar to patches, diffs: * Don't have a commit header (username, commit message, etc) * Support the optional `path=foo/bar.py` query param to filter the diff to just that one file diff The raw diff is returned as-is, in whatever encoding the files in the repository use. It is not decoded into unicode. As such, the content-type is `text/plain`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **spec** | **string**| | + **repoSlug** | **string**| | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **spec** | **string**| | + **repoSlug** | **string**| | + **context** | **int32**| Generate diffs with <n> lines of context instead of the usual three | + **path** | **string**| Limit the diff to a particular file (this parameter can be repeated for multiple paths) | + **ignoreWhitespace** | **bool**| Generate diffs that ignore whitespace | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPatchSpecGet** +> RepositoriesUsernameRepoSlugPatchSpecGet(ctx, username, spec, repoSlug) + + +Produces a raw patch for a single commit (diffed against its first parent), or a patch-series for a revspec of 2 commits (e.g. `3a8b42..9ff173` where the first commit represents the source and the second commit the destination). In case of the latter (diffing a revspec), a patch series is returned for the commits on the source branch (`3a8b42` and its ancestors in our example). For Mercurial, a single patch is returned that combines the changes of all commits on the source branch. While similar to diffs, patches: * Have a commit header (username, commit message, etc) * Do not support the `path=foo/bar.py` query parameter The raw patch is returned as-is, in whatever encoding the files in the repository use. It is not decoded into unicode. As such, the content-type is `text/plain`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **spec** | **string**| | + **repoSlug** | **string**| | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Commitstatus.md b/docs/Commitstatus.md new file mode 100644 index 0000000..5d65e9e --- /dev/null +++ b/docs/Commitstatus.md @@ -0,0 +1,20 @@ +# Commitstatus + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***CommitstatusLinks**](commitstatus_links.md) | | [optional] [default to null] +**Uuid** | **string** | The commit status' id. | [optional] [default to null] +**Key** | **string** | An identifier for the status that's unique to its type (current \"build\" is the only supported type) and the vendor, e.g. BB-DEPLOY | [optional] [default to null] +**Refname** | **string** | The name of the ref that pointed to this commit at the time the status object was created. Note that this the ref may since have moved off of the commit. This optional field can be useful for build systems whose build triggers and configuration are branch-dependent (e.g. a Pipeline build). It is legitimate for this field to not be set, or even apply (e.g. a static linting job). | [optional] [default to null] +**Url** | **string** | A URL linking back to the vendor or build system, for providing more information about whatever process produced this status. Accepts context variables `repository` and `commit` that Bitbucket will evaluate at runtime whenever at runtime. For example, one could use https://foo.com/builds/{repository.full_name} which Bitbucket will turn into https://foo.com/builds/foo/bar at render time. | [optional] [default to null] +**State** | **string** | Provides some indication of the status of this commit | [optional] [default to null] +**Name** | **string** | An identifier for the build itself, e.g. BB-DEPLOY-1 | [optional] [default to null] +**Description** | **string** | A description of the build (e.g. \"Unit tests in Bamboo\") | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**UpdatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CommitstatusLinks.md b/docs/CommitstatusLinks.md new file mode 100644 index 0000000..c179e54 --- /dev/null +++ b/docs/CommitstatusLinks.md @@ -0,0 +1,11 @@ +# CommitstatusLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Commit** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CommitstatusesApi.md b/docs/CommitstatusesApi.md new file mode 100644 index 0000000..bd87828 --- /dev/null +++ b/docs/CommitstatusesApi.md @@ -0,0 +1,188 @@ +# \CommitstatusesApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet**](CommitstatusesApi.md#RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet) | **Get** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key} | +[**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut**](CommitstatusesApi.md#RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut) | **Put** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key} | +[**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost**](CommitstatusesApi.md#RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost) | **Post** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build | +[**RepositoriesUsernameRepoSlugCommitNodeStatusesGet**](CommitstatusesApi.md#RepositoriesUsernameRepoSlugCommitNodeStatusesGet) | **Get** /repositories/{username}/{repo_slug}/commit/{node}/statuses | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet**](CommitstatusesApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/statuses | + + +# **RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet** +> Commitstatus RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet(ctx, username, repoSlug, node, key) + + +Returns the specified build status for a commit. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + **key** | **string**| The build status' unique key | + +### Return type + +[**Commitstatus**](commitstatus.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut** +> Commitstatus RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut(ctx, username, repoSlug, node, key, optional) + + +Used to update the current status of a build status object on the specific commit. This operation can also be used to change other properties of the build status: * `state` * `name` * `description` * `url` * `refname` The `key` cannot be changed. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + **key** | **string**| The commit status' unique key | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + **key** | **string**| The commit status' unique key | + **body** | [**Commitstatus**](Commitstatus.md)| The updated build status object | + +### Return type + +[**Commitstatus**](commitstatus.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost** +> Commitstatus RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost(ctx, username, repoSlug, node, optional) + + +Creates a new build status against the specified commit. If the specified key already exists, the existing status object will be overwritten. When creating a new commit status, you can use a URI template for the URL. Templates are URLs that contain variable names that Bitbucket will evaluate at runtime whenever the URL is displayed anywhere similar to parameter substitution in [Bitbucket Connect](https://developer.atlassian.com/bitbucket/concepts/context-parameters.html). For example, one could use `https://foo.com/builds/{repository.full_name}` which Bitbucket will turn into `https://foo.com/builds/foo/bar` at render time. The context variables available are `repository` and `commit`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + **body** | [**Commitstatus**](Commitstatus.md)| The new commit status object. | + +### Return type + +[**Commitstatus**](commitstatus.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitNodeStatusesGet** +> PaginatedCommitstatuses RepositoriesUsernameRepoSlugCommitNodeStatusesGet(ctx, username, repoSlug, node) + + +Returns all statuses (e.g. build results) for a specific commit. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + +### Return type + +[**PaginatedCommitstatuses**](paginated_commitstatuses.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet** +> PaginatedCommitstatuses RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet(ctx, username, repoSlug, pullRequestId) + + +Returns all statuses (e.g. build results) for the given pull request. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **pullRequestId** | **int32**| The pull request's id | + +### Return type + +[**PaginatedCommitstatuses**](paginated_commitstatuses.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Component.md b/docs/Component.md new file mode 100644 index 0000000..5f980f4 --- /dev/null +++ b/docs/Component.md @@ -0,0 +1,13 @@ +# Component + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***MilestoneLinks**](milestone_links.md) | | [optional] [default to null] +**Name** | **string** | | [optional] [default to null] +**Id** | **int32** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md new file mode 100644 index 0000000..1110a01 --- /dev/null +++ b/docs/DefaultApi.md @@ -0,0 +1,238 @@ +# \DefaultApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameDelete**](DefaultApi.md#RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameDelete) | **Delete** /repositories/{username}/{repo_slug}/properties/{app_key}/{property_name} | +[**RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameGet**](DefaultApi.md#RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameGet) | **Get** /repositories/{username}/{repo_slug}/properties/{app_key}/{property_name} | +[**RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNamePut**](DefaultApi.md#RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNamePut) | **Put** /repositories/{username}/{repo_slug}/properties/{app_key}/{property_name} | +[**TeamsUsernamePermissionsGet**](DefaultApi.md#TeamsUsernamePermissionsGet) | **Get** /teams/{username}/permissions | +[**TeamsUsernamePermissionsRepositoriesGet**](DefaultApi.md#TeamsUsernamePermissionsRepositoriesGet) | **Get** /teams/{username}/permissions/repositories | +[**TeamsUsernameSearchCodeGet**](DefaultApi.md#TeamsUsernameSearchCodeGet) | **Get** /teams/{username}/search/code | +[**UserPermissionsTeamsGet**](DefaultApi.md#UserPermissionsTeamsGet) | **Get** /user/permissions/teams | +[**UsersUsernameSearchCodeGet**](DefaultApi.md#UsersUsernameSearchCodeGet) | **Get** /users/{username}/search/code | + + +# **RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameDelete** +> RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameDelete(ctx, ) + + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameGet** +> RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNameGet(ctx, ) + + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNamePut** +> RepositoriesUsernameRepoSlugPropertiesAppKeyPropertyNamePut(ctx, ) + + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernamePermissionsGet** +> PaginatedTeamPermissions TeamsUsernamePermissionsGet(ctx, username, optional) + + +Returns an object for each team permission a user on the team has. Permissions returned are effective permissions — if a user is a member of multiple groups with distinct roles, only the highest level is returned. Permissions can be: * `admin` * `collaborator` Only users with admin permission for the team may access this resource. Example: ``` $ curl https://api.bitbucket.org/2.0/teams/atlassian_tutorial/permissions { \"pagelen\": 10, \"values\": [ { \"permission\": \"admin\", \"type\": \"team_permission\", \"user\": { \"type\": \"user\", \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\" }, \"team\": { \"username\": \"bitbucket\", \"display_name\": \"Atlassian Bitbucket\", \"uuid\": \"{4cc6108a-a241-4db0-96a5-64347ac04f87}\" } }, { \"permission\": \"collaborator\", \"type\": \"team_permission\", \"user\": { \"type\": \"user\", \"username\": \"seanaty\", \"display_name\": \"Sean Conaty\", \"uuid\": \"{504c3b62-8120-4f0c-a7bc-87800b9d6f70}\" }, \"team\": { \"username\": \"bitbucket\", \"display_name\": \"Atlassian Bitbucket\", \"uuid\": \"{4cc6108a-a241-4db0-96a5-64347ac04f87}\" } } ], \"page\": 1, \"size\": 2 } ``` Results may be further [filtered or sorted](../../../meta/filtering) by team, user, or permission by adding the following query string parameters: * `q=user.username=\"evzijst\"` or `q=permission=\"admin\"` * `sort=team.display_name` Note that the query parameter values need to be URL escaped so that `=` would become `%3D`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the team, surrounded by curly-braces, for example: `{team UUID}`. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| This can either be the username or the UUID of the team, surrounded by curly-braces, for example: `{team UUID}`. | + **q** | **string**| Query string to narrow down the response as per [filtering and sorting](../../../meta/filtering). | + **sort** | **string**| Name of a response property sort the result by as per [filtering and sorting](../../../meta/filtering#query-sort). | + +### Return type + +[**PaginatedTeamPermissions**](paginated_team_permissions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernamePermissionsRepositoriesGet** +> PaginatedRepositoryPermissions TeamsUsernamePermissionsRepositoriesGet(ctx, username, optional) + + +Returns an object for each repository permission for all of a team’s repositories. Permissions returned are effective permissions — the highest level of permission the user has. This does not include public repositories that users are not granted any specific permission in, and does not distinguish between direct and indirect privileges. Only users with admin permission for the team may access this resource. Permissions can be: * `admin` * `write` * `read` Example: ``` $ curl https://api.bitbucket.org/2.0/teams/atlassian_tutorial/permissions/repositories { \"pagelen\": 10, \"values\": [ { \"type\": \"repository_permission\", \"user\": { \"type\": \"user\", \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\" }, \"repository\": { \"type\": \"repository\", \"name\": \"geordi\", \"full_name\": \"bitbucket/geordi\", \"uuid\": \"{85d08b4e-571d-44e9-a507-fa476535aa98}\" }, \"permission\": \"admin\" }, { \"type\": \"repository_permission\", \"user\": { \"type\": \"user\", \"username\": \"seanaty\", \"display_name\": \"Sean Conaty\", \"uuid\": \"{504c3b62-8120-4f0c-a7bc-87800b9d6f70}\" }, \"repository\": { \"type\": \"repository\", \"name\": \"geordi\", \"full_name\": \"bitbucket/geordi\", \"uuid\": \"{85d08b4e-571d-44e9-a507-fa476535aa98}\" }, \"permission\": \"write\" } ], \"page\": 1, \"size\": 2 } ``` Results may be further [filtered or sorted](../../../../meta/filtering) by repository, user, or permission by adding the following query string parameters: * `q=repository.name=\"geordi\"` or `q=permission>\"read\"` * `sort=user.display_name` Note that the query parameter values need to be URL escaped so that `=` would become `%3D`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the team, surrounded by curly-braces, for example: `{team UUID}`. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| This can either be the username or the UUID of the team, surrounded by curly-braces, for example: `{team UUID}`. | + **q** | **string**| Query string to narrow down the response as per [filtering and sorting](../../../../meta/filtering). | + **sort** | **string**| Name of a response property sort the result by as per [filtering and sorting](../../../../meta/filtering#query-sort). | + +### Return type + +[**PaginatedRepositoryPermissions**](paginated_repository_permissions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameSearchCodeGet** +> SearchResult TeamsUsernameSearchCodeGet(ctx, ) + + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**SearchResult**](search_result.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UserPermissionsTeamsGet** +> PaginatedTeamPermissions UserPermissionsTeamsGet(ctx, optional) + + +Returns an object for each team the caller is a member of, and their effective role — the highest level of privilege the caller has. If a user is a member of multiple groups with distinct roles, only the highest level is returned. Permissions can be: * `admin` * `collaborator` Example: ``` $ curl https://api.bitbucket.org/2.0/user/permissions/teams { \"pagelen\": 10, \"values\": [ { \"permission\": \"admin\", \"type\": \"team_permission\", \"user\": { \"type\": \"user\", \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\" }, \"team\": { \"username\": \"bitbucket\", \"display_name\": \"Atlassian Bitbucket\", \"uuid\": \"{4cc6108a-a241-4db0-96a5-64347ac04f87}\" } } ], \"page\": 1, \"size\": 1 } ``` Results may be further [filtered or sorted](../../../meta/filtering) by team or permission by adding the following query string parameters: * `q=team.username=\"bitbucket\"` or `q=permission=\"admin\"` * `sort=team.display_name` Note that the query parameter values need to be URL escaped so that `=` would become `%3D`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **q** | **string**| Query string to narrow down the response as per [filtering and sorting](../../../meta/filtering). | + **sort** | **string**| Name of a response property sort the result by as per [filtering and sorting](../../../meta/filtering#query-sort). | + +### Return type + +[**PaginatedTeamPermissions**](paginated_team_permissions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameSearchCodeGet** +> SearchResult UsersUsernameSearchCodeGet(ctx, ) + + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**SearchResult**](search_result.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/DownloadsApi.md b/docs/DownloadsApi.md new file mode 100644 index 0000000..8a3a80b --- /dev/null +++ b/docs/DownloadsApi.md @@ -0,0 +1,130 @@ +# \DownloadsApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**RepositoriesUsernameRepoSlugDownloadsFilenameDelete**](DownloadsApi.md#RepositoriesUsernameRepoSlugDownloadsFilenameDelete) | **Delete** /repositories/{username}/{repo_slug}/downloads/{filename} | +[**RepositoriesUsernameRepoSlugDownloadsFilenameGet**](DownloadsApi.md#RepositoriesUsernameRepoSlugDownloadsFilenameGet) | **Get** /repositories/{username}/{repo_slug}/downloads/{filename} | +[**RepositoriesUsernameRepoSlugDownloadsGet**](DownloadsApi.md#RepositoriesUsernameRepoSlugDownloadsGet) | **Get** /repositories/{username}/{repo_slug}/downloads | +[**RepositoriesUsernameRepoSlugDownloadsPost**](DownloadsApi.md#RepositoriesUsernameRepoSlugDownloadsPost) | **Post** /repositories/{username}/{repo_slug}/downloads | + + +# **RepositoriesUsernameRepoSlugDownloadsFilenameDelete** +> ModelError RepositoriesUsernameRepoSlugDownloadsFilenameDelete(ctx, username, filename, repoSlug) + + +Deletes the specified download artifact from the repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **filename** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugDownloadsFilenameGet** +> ModelError RepositoriesUsernameRepoSlugDownloadsFilenameGet(ctx, username, filename, repoSlug) + + +Return a redirect to the contents of a download artifact. This endpoint returns the actual file contents and not the artifact's metadata. $ curl -s -L https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads/hello.txt Hello World + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **filename** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugDownloadsGet** +> ModelError RepositoriesUsernameRepoSlugDownloadsGet(ctx, username, repoSlug) + + +Returns a list of download links associated with the repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugDownloadsPost** +> ModelError RepositoriesUsernameRepoSlugDownloadsPost(ctx, username, repoSlug) + + +Upload new download artifacts. To upload files, perform a `multipart/form-data` POST containing one or more `files` fields: $ echo Hello World > hello.txt $ curl -s -u evzijst -X POST https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads -F files=@hello.txt When a file is uploaded with the same name as an existing artifact, then the existing file will be replaced. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/ErrorError.md b/docs/ErrorError.md new file mode 100644 index 0000000..399f754 --- /dev/null +++ b/docs/ErrorError.md @@ -0,0 +1,12 @@ +# ErrorError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | **string** | | [default to null] +**Detail** | **string** | | [optional] [default to null] +**Data** | [***interface{}**](interface{}.md) | Optional structured data that is endpoint-specific. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Group.md b/docs/Group.md new file mode 100644 index 0000000..bd96f7a --- /dev/null +++ b/docs/Group.md @@ -0,0 +1,16 @@ +# Group + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***GroupLinks**](group_links.md) | | [optional] [default to null] +**Owner** | [***Account**](account.md) | | [optional] [default to null] +**Name** | **string** | | [optional] [default to null] +**Slug** | **string** | The \"sluggified\" version of the group's name. This contains only ASCII characters and can therefore be slightly different than the name | [optional] [default to null] +**FullSlug** | **string** | The concatenation of the owner's username and the group's slug, separated with a colon (e.g. `acme:developers`) | [optional] [default to null] +**Members** | **int32** | The number of members in this group | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GroupLinks.md b/docs/GroupLinks.md new file mode 100644 index 0000000..34b7263 --- /dev/null +++ b/docs/GroupLinks.md @@ -0,0 +1,11 @@ +# GroupLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Html** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/HookEvent.md b/docs/HookEvent.md new file mode 100644 index 0000000..fb3a551 --- /dev/null +++ b/docs/HookEvent.md @@ -0,0 +1,13 @@ +# HookEvent + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Event** | **string** | The event identifier. | [optional] [default to null] +**Category** | **string** | The category this event belongs to. | [optional] [default to null] +**Label** | **string** | Summary of the webhook event type. | [optional] [default to null] +**Description** | **string** | More detailed description of the webhook event type. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Issue.md b/docs/Issue.md new file mode 100644 index 0000000..2df2501 --- /dev/null +++ b/docs/Issue.md @@ -0,0 +1,27 @@ +# Issue + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***IssueLinks**](issue_links.md) | | [optional] [default to null] +**Id** | **int32** | | [optional] [default to null] +**Repository** | [***Repository**](repository.md) | | [optional] [default to null] +**Title** | **string** | | [optional] [default to null] +**Reporter** | [***User**](user.md) | | [optional] [default to null] +**Assignee** | [***User**](user.md) | | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**UpdatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**EditedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**State** | **string** | | [optional] [default to null] +**Kind** | **string** | | [optional] [default to null] +**Priority** | **string** | | [optional] [default to null] +**Milestone** | [***Milestone**](milestone.md) | | [optional] [default to null] +**Version** | [***Version**](version.md) | | [optional] [default to null] +**Component** | [***Component**](component.md) | | [optional] [default to null] +**Votes** | **int32** | | [optional] [default to null] +**Content** | [***PullrequestSummary**](pullrequest_summary.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/IssueAttachment.md b/docs/IssueAttachment.md new file mode 100644 index 0000000..c3376b6 --- /dev/null +++ b/docs/IssueAttachment.md @@ -0,0 +1,12 @@ +# IssueAttachment + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***MilestoneLinks**](milestone_links.md) | | [optional] [default to null] +**Name** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/IssueChange.md b/docs/IssueChange.md new file mode 100644 index 0000000..f6a07a8 --- /dev/null +++ b/docs/IssueChange.md @@ -0,0 +1,17 @@ +# IssueChange + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***IssueChangeLinks**](issue_change_links.md) | | [optional] [default to null] +**Name** | **string** | | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**User** | [***User**](user.md) | | [optional] [default to null] +**Issue** | [***Issue**](issue.md) | | [optional] [default to null] +**Changes** | [***IssueChangeChanges**](issue_change_changes.md) | | [optional] [default to null] +**Message** | [***PullrequestSummary**](pullrequest_summary.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/IssueChangeChanges.md b/docs/IssueChangeChanges.md new file mode 100644 index 0000000..4e56ea5 --- /dev/null +++ b/docs/IssueChangeChanges.md @@ -0,0 +1,18 @@ +# IssueChangeChanges + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Assignee** | [***IssueChangeChangesAssignee**](issue_change_changes_assignee.md) | | [optional] [default to null] +**State** | [***IssueChangeChangesAssignee**](issue_change_changes_assignee.md) | | [optional] [default to null] +**Title** | [***IssueChangeChangesAssignee**](issue_change_changes_assignee.md) | | [optional] [default to null] +**Kind** | [***IssueChangeChangesAssignee**](issue_change_changes_assignee.md) | | [optional] [default to null] +**Milestone** | [***IssueChangeChangesAssignee**](issue_change_changes_assignee.md) | | [optional] [default to null] +**Component** | [***IssueChangeChangesAssignee**](issue_change_changes_assignee.md) | | [optional] [default to null] +**Priority** | [***IssueChangeChangesAssignee**](issue_change_changes_assignee.md) | | [optional] [default to null] +**Version** | [***IssueChangeChangesAssignee**](issue_change_changes_assignee.md) | | [optional] [default to null] +**Content** | [***IssueChangeChangesAssignee**](issue_change_changes_assignee.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/IssueChangeChangesAssignee.md b/docs/IssueChangeChangesAssignee.md new file mode 100644 index 0000000..6fe7762 --- /dev/null +++ b/docs/IssueChangeChangesAssignee.md @@ -0,0 +1,11 @@ +# IssueChangeChangesAssignee + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Old** | **string** | | [optional] [default to null] +**New** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/IssueChangeLinks.md b/docs/IssueChangeLinks.md new file mode 100644 index 0000000..8405931 --- /dev/null +++ b/docs/IssueChangeLinks.md @@ -0,0 +1,11 @@ +# IssueChangeLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Issue** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/IssueLinks.md b/docs/IssueLinks.md new file mode 100644 index 0000000..cca5c2a --- /dev/null +++ b/docs/IssueLinks.md @@ -0,0 +1,15 @@ +# IssueLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Html** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Comments** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Attachments** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Watch** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Vote** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/IssueTrackerApi.md b/docs/IssueTrackerApi.md new file mode 100644 index 0000000..a2b01ac --- /dev/null +++ b/docs/IssueTrackerApi.md @@ -0,0 +1,827 @@ +# \IssueTrackerApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**RepositoriesUsernameRepoSlugComponentsComponentIdGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugComponentsComponentIdGet) | **Get** /repositories/{username}/{repo_slug}/components/{component_id} | +[**RepositoriesUsernameRepoSlugComponentsGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugComponentsGet) | **Get** /repositories/{username}/{repo_slug}/components | +[**RepositoriesUsernameRepoSlugIssuesGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesGet) | **Get** /repositories/{username}/{repo_slug}/issues | +[**RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsGet) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/attachments | +[**RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathDelete**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathDelete) | **Delete** /repositories/{username}/{repo_slug}/issues/{issue_id}/attachments/{path} | +[**RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathGet) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/attachments/{path} | +[**RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPost**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPost) | **Post** /repositories/{username}/{repo_slug}/issues/{issue_id}/attachments | +[**RepositoriesUsernameRepoSlugIssuesIssueIdChangesChangeIdGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdChangesChangeIdGet) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/changes/{change_id} | +[**RepositoriesUsernameRepoSlugIssuesIssueIdChangesGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdChangesGet) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/changes | +[**RepositoriesUsernameRepoSlugIssuesIssueIdChangesPost**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdChangesPost) | **Post** /repositories/{username}/{repo_slug}/issues/{issue_id}/changes | +[**RepositoriesUsernameRepoSlugIssuesIssueIdCommentsCommentIdGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdCommentsCommentIdGet) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/comments/{comment_id} | +[**RepositoriesUsernameRepoSlugIssuesIssueIdCommentsGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdCommentsGet) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/comments | +[**RepositoriesUsernameRepoSlugIssuesIssueIdDelete**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdDelete) | **Delete** /repositories/{username}/{repo_slug}/issues/{issue_id} | +[**RepositoriesUsernameRepoSlugIssuesIssueIdGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdGet) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id} | +[**RepositoriesUsernameRepoSlugIssuesIssueIdPut**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdPut) | **Put** /repositories/{username}/{repo_slug}/issues/{issue_id} | +[**RepositoriesUsernameRepoSlugIssuesIssueIdVoteDelete**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdVoteDelete) | **Delete** /repositories/{username}/{repo_slug}/issues/{issue_id}/vote | +[**RepositoriesUsernameRepoSlugIssuesIssueIdVoteGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdVoteGet) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/vote | +[**RepositoriesUsernameRepoSlugIssuesIssueIdVotePut**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdVotePut) | **Put** /repositories/{username}/{repo_slug}/issues/{issue_id}/vote | +[**RepositoriesUsernameRepoSlugIssuesIssueIdWatchDelete**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdWatchDelete) | **Delete** /repositories/{username}/{repo_slug}/issues/{issue_id}/watch | +[**RepositoriesUsernameRepoSlugIssuesIssueIdWatchGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdWatchGet) | **Get** /repositories/{username}/{repo_slug}/issues/{issue_id}/watch | +[**RepositoriesUsernameRepoSlugIssuesIssueIdWatchPut**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesIssueIdWatchPut) | **Put** /repositories/{username}/{repo_slug}/issues/{issue_id}/watch | +[**RepositoriesUsernameRepoSlugIssuesPost**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugIssuesPost) | **Post** /repositories/{username}/{repo_slug}/issues | +[**RepositoriesUsernameRepoSlugMilestonesGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugMilestonesGet) | **Get** /repositories/{username}/{repo_slug}/milestones | +[**RepositoriesUsernameRepoSlugMilestonesMilestoneIdGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugMilestonesMilestoneIdGet) | **Get** /repositories/{username}/{repo_slug}/milestones/{milestone_id} | +[**RepositoriesUsernameRepoSlugVersionsGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugVersionsGet) | **Get** /repositories/{username}/{repo_slug}/versions | +[**RepositoriesUsernameRepoSlugVersionsVersionIdGet**](IssueTrackerApi.md#RepositoriesUsernameRepoSlugVersionsVersionIdGet) | **Get** /repositories/{username}/{repo_slug}/versions/{version_id} | + + +# **RepositoriesUsernameRepoSlugComponentsComponentIdGet** +> Component RepositoriesUsernameRepoSlugComponentsComponentIdGet(ctx, username, repoSlug, componentId) + + +Returns the specified issue tracker component object. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **componentId** | **int32**| The component's id | + +### Return type + +[**Component**](component.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugComponentsGet** +> PaginatedComponents RepositoriesUsernameRepoSlugComponentsGet(ctx, username, repoSlug) + + +Returns the components that have been defined in the issue tracker. This resource is only available on repositories that have the issue tracker enabled. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**PaginatedComponents**](paginated_components.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesGet** +> PaginatedIssues RepositoriesUsernameRepoSlugIssuesGet(ctx, username, repoSlug) + + +Returns the issues in the issue tracker. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**PaginatedIssues**](paginated_issues.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsGet** +> PaginatedIssueAttachments RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsGet(ctx, username, repoSlug, issueId) + + +Returns all attachments for this issue. This returns the files' meta data. This does not return the files' actual contents. The files are always ordered by their upload date. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **int32**| The issue's id | + +### Return type + +[**PaginatedIssueAttachments**](paginated_issue_attachments.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathDelete** +> RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathDelete(ctx, username, path, issueId, repoSlug) + + +Deletes an attachment. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **path** | **string**| | + **issueId** | **string**| | + **repoSlug** | **string**| | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathGet** +> RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathGet(ctx, username, path, issueId, repoSlug) + + +Returns the contents of the specified file attachment. Note that this endpoint does not return a JSON response, but instead returns a redirect pointing to the actual file that in turn will return the raw contents. The redirect URL contains a one-time token that has a limited lifetime. As a result, the link should not be persisted, stored, or shared. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **path** | **string**| | + **issueId** | **string**| | + **repoSlug** | **string**| | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPost** +> RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPost(ctx, username, repoSlug, issueId) + + +Upload new issue attachments. To upload files, perform a `multipart/form-data` POST containing one or more file fields. When a file is uploaded with the same name as an existing attachment, then the existing file will be replaced. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **int32**| The issue's id | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdChangesChangeIdGet** +> IssueChange RepositoriesUsernameRepoSlugIssuesIssueIdChangesChangeIdGet(ctx, username, repoSlug, issueId, changeId) + + +Returns the specified issue change object. This resource is only available on repositories that have the issue tracker enabled. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **string**| The issue id | + **changeId** | **string**| The issue change id | + +### Return type + +[**IssueChange**](issue_change.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdChangesGet** +> PaginatedLogEntries RepositoriesUsernameRepoSlugIssuesIssueIdChangesGet(ctx, username, repoSlug, issueId, optional) + + +Returns the list of all changes that have been made to the specified issue. Changes are returned in chronological order with the oldest change first. Each time an issue is edited in the UI or through the API, an immutable change record is created. It also has a comment associated to it. ``` $ curl -s https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1/changes - | jq . { \"pagelen\": 20, \"values\": [ { \"changes\": { \"priority\": { \"new\": \"trivial\", \"old\": \"major\" }, \"assignee\": { \"new\": \"\", \"old\": \"evzijst\" }, \"kind\": { \"new\": \"enhancement\", \"old\": \"bug\" } }, \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1/changes/2\" }, \"html\": { \"href\": \"https://bitbucket.org/evzijst/dogslow/issues/1#comment-2\" } }, \"issue\": { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1\" } }, \"type\": \"issue\", \"id\": 1, \"repository\": { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/evzijst/dogslow\" }, \"html\": { \"href\": \"https://bitbucket.org/evzijst/dogslow\" }, \"avatar\": { \"href\": \"https://bitbucket.org/evzijst/dogslow/avatar/32/\" } }, \"type\": \"repository\", \"name\": \"dogslow\", \"full_name\": \"evzijst/dogslow\", \"uuid\": \"{988b17c6-1a47-4e70-84ee-854d5f012bf6}\" }, \"title\": \"Updated title\" }, \"created_on\": \"2018-03-03T00:35:28.353630+00:00\", \"user\": { \"username\": \"evzijst\", \"display_name\": \"evzijst\", \"type\": \"user\", \"uuid\": \"{aaa7972b-38af-4fb1-802d-6e3854c95778}\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\" }, \"html\": { \"href\": \"https://bitbucket.org/evzijst/\" }, \"avatar\": { \"href\": \"https://bitbucket.org/account/evzijst/avatar/32/\" } } }, \"message\": { \"raw\": \"Removed assignee, changed kind and priority.\", \"markup\": \"markdown\", \"html\": \"

Removed assignee, changed kind and priority.

\", \"type\": \"rendered\" }, \"type\": \"issue_change\", \"id\": 2 } ], \"page\": 1 } ``` Changes support [filtering and sorting](../../../meta/filtering) that can be used to search for specific changes. For instance, to see when an issue transitioned to \"resolved\": ``` $ curl -s https://api.bitbucket.org/2.0/repositories/site/master/issues/1/changes \\ -G --data-urlencode='q=changes.state.new = \"resolved\"' ``` This resource is only available on repositories that have the issue tracker enabled. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **string**| The issue id | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **string**| The issue id | + **q** | **string**| Query string to narrow down the response as per [filtering and sorting](../../../meta/filtering). | + **sort** | **string**| Name of a response property to sort the result by as per [filtering and sorting](../../../meta/filtering#query-sort). | + +### Return type + +[**PaginatedLogEntries**](paginated_log_entries.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdChangesPost** +> IssueChange RepositoriesUsernameRepoSlugIssuesIssueIdChangesPost(ctx, username, issueId, repoSlug, body) + + +Makes a change to the specified issue. For example, to change an issue's state and assignee, create a new change object that modifies these fields: ``` curl https://api.bitbucket.org/2.0/site/master/issues/1234/changes \\ -s -u evzijst -X POST -H \"Content-Type: application/json\" \\ -d '{ \"changes\": { \"assignee\": { \"new\": \"evzijst\" }, \"state\": { \"new\": 'resolved\" } } \"message\": { \"raw\": \"This is now resolved.\" } }' ``` The above example also includes a custom comment to go alongside the change. This comment will also be visible on the issue page in the UI. Note that the fields of the `changes` object are strings, not objects. This allows for immutable change log records, even after user accounts, milestones, or other objects recorded in a change entry, get renamed or deleted. The assignee field stores the username. When POSTing a new change and changing the assignee, the client should also use the username in the `changes.assignee.new` field. This call requires authentication. Private repositories or private issue trackers require the caller to authenticate with an account that has appropriate authorization. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **issueId** | **string**| | + **repoSlug** | **string**| | + **body** | [**IssueChange**](IssueChange.md)| The new issue state change. Note that the only required elements are `changes.[].new`. All other elements can be omitted from the body. | + +### Return type + +[**IssueChange**](issue_change.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdCommentsCommentIdGet** +> ModelError RepositoriesUsernameRepoSlugIssuesIssueIdCommentsCommentIdGet(ctx, username, commentId, issueId, repoSlug) + + +Returns the specified issue comment object. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **commentId** | **string**| | + **issueId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdCommentsGet** +> ModelError RepositoriesUsernameRepoSlugIssuesIssueIdCommentsGet(ctx, username, issueId, repoSlug) + + +Returns all comments that were made on the specified issue. The default sorting is oldest to newest and can be overridden with the `sort` query parameter. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **issueId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdDelete** +> Issue RepositoriesUsernameRepoSlugIssuesIssueIdDelete(ctx, username, issueId, repoSlug) + + +Deletes the specified issue. This requires write access to the repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **issueId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**Issue**](issue.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdGet** +> Issue RepositoriesUsernameRepoSlugIssuesIssueIdGet(ctx, username, issueId, repoSlug) + + +Returns the specified issue. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **issueId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**Issue**](issue.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdPut** +> Issue RepositoriesUsernameRepoSlugIssuesIssueIdPut(ctx, username, repoSlug, issueId) + + +Modifies the issue. ``` $ curl https://api.bitbucket.org/2.0/repostories/evzijst/dogslow/issues/123 \\ -u evzijst -s -X PUT -H 'Content-Type: application/json' \\ -d '{ \"title\": \"Updated title\", \"assignee\": { \"username\": \"evzijst\" }, \"priority\": \"minor\", \"version\": { \"name\": \"1.0\" }, \"component\": null }' ``` The example above changes the `title`, `assignee`, `priority` and the `version`. It also removes the `component` from the issue by setting the field explicitly to `null`. Any field that is not present will keep its existing value. Note that the issue tracker keeps a list of all modifications made to an issue under the `/issues/123/changes` endpoint and a PUT to this endpoint will create a new changes record. Issues can also be manipulated by POSTing directly to the issue `/changes` endpoint. This is equivalent to a PUT here, except that the client is able to provide a message that will be stored alongside the change record. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **string**| The issue id | + +### Return type + +[**Issue**](issue.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdVoteDelete** +> ModelError RepositoriesUsernameRepoSlugIssuesIssueIdVoteDelete(ctx, username, repoSlug, issueId) + + +Retract your vote. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **int32**| The issue's id | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdVoteGet** +> ModelError RepositoriesUsernameRepoSlugIssuesIssueIdVoteGet(ctx, username, repoSlug, issueId) + + +Check whether the authenticated user has voted for this issue. A 204 status code indicates that the user has voted, while a 404 implies they haven't. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **int32**| The issue's id | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdVotePut** +> ModelError RepositoriesUsernameRepoSlugIssuesIssueIdVotePut(ctx, username, repoSlug, issueId) + + +Vote for this issue. To cast your vote, do an empty PUT. The 204 status code indicates that the operation was successful. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **int32**| The issue's id | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdWatchDelete** +> ModelError RepositoriesUsernameRepoSlugIssuesIssueIdWatchDelete(ctx, username, repoSlug, issueId) + + +Stop watching this issue. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **int32**| The issue's id | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdWatchGet** +> ModelError RepositoriesUsernameRepoSlugIssuesIssueIdWatchGet(ctx, username, repoSlug, issueId) + + +Indicated whether or not the authenticated user is watching this issue. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **int32**| The issue's id | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesIssueIdWatchPut** +> ModelError RepositoriesUsernameRepoSlugIssuesIssueIdWatchPut(ctx, username, repoSlug, issueId) + + +Start watching this issue. To start watching this issue, do an empty PUT. The 204 status code indicates that the operation was successful. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **issueId** | **int32**| The issue's id | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugIssuesPost** +> Issue RepositoriesUsernameRepoSlugIssuesPost(ctx, username, repoSlug, body) + + +Creates a new issue. This call requires authentication. Private repositories or private issue trackers require the caller to authenticate with an account that has appropriate authorisation. The authenticated user is used for the issue's `reporter` field. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **body** | [**Issue**](Issue.md)| The new issue. Note that the only required element is `title`. All other elements can be omitted from the body. | + +### Return type + +[**Issue**](issue.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugMilestonesGet** +> PaginatedMilestones RepositoriesUsernameRepoSlugMilestonesGet(ctx, username, repoSlug) + + +Returns the milestones that have been defined in the issue tracker. This resource is only available on repositories that have the issue tracker enabled. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**PaginatedMilestones**](paginated_milestones.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugMilestonesMilestoneIdGet** +> Milestone RepositoriesUsernameRepoSlugMilestonesMilestoneIdGet(ctx, username, repoSlug, milestoneId) + + +Returns the specified issue tracker milestone object. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **milestoneId** | **int32**| The milestone's id | + +### Return type + +[**Milestone**](milestone.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugVersionsGet** +> PaginatedVersions RepositoriesUsernameRepoSlugVersionsGet(ctx, username, repoSlug) + + +Returns the versions that have been defined in the issue tracker. This resource is only available on repositories that have the issue tracker enabled. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**PaginatedVersions**](paginated_versions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugVersionsVersionIdGet** +> Version RepositoriesUsernameRepoSlugVersionsVersionIdGet(ctx, username, repoSlug, versionId) + + +Returns the specified issue tracker version object. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **versionId** | **int32**| The version's id | + +### Return type + +[**Version**](version.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Milestone.md b/docs/Milestone.md new file mode 100644 index 0000000..ccc5b75 --- /dev/null +++ b/docs/Milestone.md @@ -0,0 +1,13 @@ +# Milestone + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***MilestoneLinks**](milestone_links.md) | | [optional] [default to null] +**Name** | **string** | | [optional] [default to null] +**Id** | **int32** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MilestoneLinks.md b/docs/MilestoneLinks.md new file mode 100644 index 0000000..28806fc --- /dev/null +++ b/docs/MilestoneLinks.md @@ -0,0 +1,10 @@ +# MilestoneLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MilestoneLinksSelf.md b/docs/MilestoneLinksSelf.md new file mode 100644 index 0000000..92b5852 --- /dev/null +++ b/docs/MilestoneLinksSelf.md @@ -0,0 +1,11 @@ +# MilestoneLinksSelf + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Href** | **string** | | [optional] [default to null] +**Name** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ModelError.md b/docs/ModelError.md new file mode 100644 index 0000000..00a75e7 --- /dev/null +++ b/docs/ModelError.md @@ -0,0 +1,11 @@ +# ModelError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Error_** | [***ErrorError**](error_error.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Object.md b/docs/Object.md new file mode 100644 index 0000000..2a9adc5 --- /dev/null +++ b/docs/Object.md @@ -0,0 +1,10 @@ +# Object + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Page.md b/docs/Page.md new file mode 100644 index 0000000..fb4bc42 --- /dev/null +++ b/docs/Page.md @@ -0,0 +1,14 @@ +# Page + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedBranchrestrictions.md b/docs/PaginatedBranchrestrictions.md new file mode 100644 index 0000000..9a55e5e --- /dev/null +++ b/docs/PaginatedBranchrestrictions.md @@ -0,0 +1,15 @@ +# PaginatedBranchrestrictions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Branchrestriction**](branchrestriction.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedCommitstatuses.md b/docs/PaginatedCommitstatuses.md new file mode 100644 index 0000000..cfc81c8 --- /dev/null +++ b/docs/PaginatedCommitstatuses.md @@ -0,0 +1,15 @@ +# PaginatedCommitstatuses + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Commitstatus**](commitstatus.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedComponents.md b/docs/PaginatedComponents.md new file mode 100644 index 0000000..cf67e49 --- /dev/null +++ b/docs/PaginatedComponents.md @@ -0,0 +1,15 @@ +# PaginatedComponents + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Component**](component.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedFiles.md b/docs/PaginatedFiles.md new file mode 100644 index 0000000..a1f186e --- /dev/null +++ b/docs/PaginatedFiles.md @@ -0,0 +1,15 @@ +# PaginatedFiles + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]CommitFile**](commit_file.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedHookEvents.md b/docs/PaginatedHookEvents.md new file mode 100644 index 0000000..3c6d73c --- /dev/null +++ b/docs/PaginatedHookEvents.md @@ -0,0 +1,15 @@ +# PaginatedHookEvents + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]HookEvent**](hook_event.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedIssueAttachments.md b/docs/PaginatedIssueAttachments.md new file mode 100644 index 0000000..9d6bd22 --- /dev/null +++ b/docs/PaginatedIssueAttachments.md @@ -0,0 +1,15 @@ +# PaginatedIssueAttachments + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]IssueAttachment**](issue_attachment.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedIssues.md b/docs/PaginatedIssues.md new file mode 100644 index 0000000..53c44a7 --- /dev/null +++ b/docs/PaginatedIssues.md @@ -0,0 +1,15 @@ +# PaginatedIssues + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Issue**](issue.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedLogEntries.md b/docs/PaginatedLogEntries.md new file mode 100644 index 0000000..9915f03 --- /dev/null +++ b/docs/PaginatedLogEntries.md @@ -0,0 +1,15 @@ +# PaginatedLogEntries + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]IssueChange**](issue_change.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedMilestones.md b/docs/PaginatedMilestones.md new file mode 100644 index 0000000..6fdb5f4 --- /dev/null +++ b/docs/PaginatedMilestones.md @@ -0,0 +1,15 @@ +# PaginatedMilestones + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Milestone**](milestone.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedPipelineKnownHosts.md b/docs/PaginatedPipelineKnownHosts.md new file mode 100644 index 0000000..ec32b8c --- /dev/null +++ b/docs/PaginatedPipelineKnownHosts.md @@ -0,0 +1,15 @@ +# PaginatedPipelineKnownHosts + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]PipelineKnownHost**](pipeline_known_host.md) | The values of the current page. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedPipelineScheduleExecutions.md b/docs/PaginatedPipelineScheduleExecutions.md new file mode 100644 index 0000000..e49f216 --- /dev/null +++ b/docs/PaginatedPipelineScheduleExecutions.md @@ -0,0 +1,15 @@ +# PaginatedPipelineScheduleExecutions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]PipelineScheduleExecution**](pipeline_schedule_execution.md) | The values of the current page. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedPipelineSchedules.md b/docs/PaginatedPipelineSchedules.md new file mode 100644 index 0000000..b01e881 --- /dev/null +++ b/docs/PaginatedPipelineSchedules.md @@ -0,0 +1,15 @@ +# PaginatedPipelineSchedules + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]PipelineSchedule**](pipeline_schedule.md) | The values of the current page. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedPipelineSteps.md b/docs/PaginatedPipelineSteps.md new file mode 100644 index 0000000..7784dae --- /dev/null +++ b/docs/PaginatedPipelineSteps.md @@ -0,0 +1,15 @@ +# PaginatedPipelineSteps + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]PipelineStep**](pipeline_step.md) | The values of the current page. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedPipelineVariables.md b/docs/PaginatedPipelineVariables.md new file mode 100644 index 0000000..6e66200 --- /dev/null +++ b/docs/PaginatedPipelineVariables.md @@ -0,0 +1,15 @@ +# PaginatedPipelineVariables + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]PipelineVariable**](pipeline_variable.md) | The values of the current page. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedPipelines.md b/docs/PaginatedPipelines.md new file mode 100644 index 0000000..1e9efd8 --- /dev/null +++ b/docs/PaginatedPipelines.md @@ -0,0 +1,15 @@ +# PaginatedPipelines + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Pipeline**](pipeline.md) | The values of the current page. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedProjects.md b/docs/PaginatedProjects.md new file mode 100644 index 0000000..05466c2 --- /dev/null +++ b/docs/PaginatedProjects.md @@ -0,0 +1,15 @@ +# PaginatedProjects + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Project**](project.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedPullrequestComments.md b/docs/PaginatedPullrequestComments.md new file mode 100644 index 0000000..dced0a0 --- /dev/null +++ b/docs/PaginatedPullrequestComments.md @@ -0,0 +1,15 @@ +# PaginatedPullrequestComments + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]PullrequestComment**](pullrequest_comment.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedPullrequests.md b/docs/PaginatedPullrequests.md new file mode 100644 index 0000000..667df0a --- /dev/null +++ b/docs/PaginatedPullrequests.md @@ -0,0 +1,15 @@ +# PaginatedPullrequests + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Pullrequest**](pullrequest.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedRepositories.md b/docs/PaginatedRepositories.md new file mode 100644 index 0000000..3d0a388 --- /dev/null +++ b/docs/PaginatedRepositories.md @@ -0,0 +1,15 @@ +# PaginatedRepositories + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Repository**](repository.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedRepositoryPermissions.md b/docs/PaginatedRepositoryPermissions.md new file mode 100644 index 0000000..7dd3989 --- /dev/null +++ b/docs/PaginatedRepositoryPermissions.md @@ -0,0 +1,15 @@ +# PaginatedRepositoryPermissions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]RepositoryPermission**](repository_permission.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedSnippetComments.md b/docs/PaginatedSnippetComments.md new file mode 100644 index 0000000..0e80a5e --- /dev/null +++ b/docs/PaginatedSnippetComments.md @@ -0,0 +1,15 @@ +# PaginatedSnippetComments + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]SnippetComment**](snippet_comment.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedSnippetCommit.md b/docs/PaginatedSnippetCommit.md new file mode 100644 index 0000000..d610ed3 --- /dev/null +++ b/docs/PaginatedSnippetCommit.md @@ -0,0 +1,15 @@ +# PaginatedSnippetCommit + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]SnippetCommit**](snippet_commit.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedSnippets.md b/docs/PaginatedSnippets.md new file mode 100644 index 0000000..25036e7 --- /dev/null +++ b/docs/PaginatedSnippets.md @@ -0,0 +1,15 @@ +# PaginatedSnippets + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Snippet**](snippet.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedSshUserKeys.md b/docs/PaginatedSshUserKeys.md new file mode 100644 index 0000000..3fe3ca2 --- /dev/null +++ b/docs/PaginatedSshUserKeys.md @@ -0,0 +1,15 @@ +# PaginatedSshUserKeys + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]SshAccountKey**](ssh_account_key.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedTeamPermissions.md b/docs/PaginatedTeamPermissions.md new file mode 100644 index 0000000..6e77a20 --- /dev/null +++ b/docs/PaginatedTeamPermissions.md @@ -0,0 +1,15 @@ +# PaginatedTeamPermissions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]TeamPermission**](team_permission.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedTeams.md b/docs/PaginatedTeams.md new file mode 100644 index 0000000..e49495b --- /dev/null +++ b/docs/PaginatedTeams.md @@ -0,0 +1,15 @@ +# PaginatedTeams + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Team**](team.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedTreeentries.md b/docs/PaginatedTreeentries.md new file mode 100644 index 0000000..164b0a5 --- /dev/null +++ b/docs/PaginatedTreeentries.md @@ -0,0 +1,15 @@ +# PaginatedTreeentries + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Treeentry**](treeentry.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedUsers.md b/docs/PaginatedUsers.md new file mode 100644 index 0000000..59b6e73 --- /dev/null +++ b/docs/PaginatedUsers.md @@ -0,0 +1,15 @@ +# PaginatedUsers + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]User**](user.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedVersions.md b/docs/PaginatedVersions.md new file mode 100644 index 0000000..4ae9a5d --- /dev/null +++ b/docs/PaginatedVersions.md @@ -0,0 +1,15 @@ +# PaginatedVersions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]Version**](version.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaginatedWebhookSubscriptions.md b/docs/PaginatedWebhookSubscriptions.md new file mode 100644 index 0000000..c7a383e --- /dev/null +++ b/docs/PaginatedWebhookSubscriptions.md @@ -0,0 +1,15 @@ +# PaginatedWebhookSubscriptions + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Size** | **int32** | Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. | [optional] [default to null] +**Page** | **int32** | Page number of the current results. This is an optional element that is not provided in all responses. | [optional] [default to null] +**Pagelen** | **int32** | Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. | [optional] [default to null] +**Next** | **string** | Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Previous** | **string** | Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. | [optional] [default to null] +**Values** | [**[]WebhookSubscription**](webhook_subscription.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Participant.md b/docs/Participant.md new file mode 100644 index 0000000..8fb9240 --- /dev/null +++ b/docs/Participant.md @@ -0,0 +1,14 @@ +# Participant + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**User** | [***User**](user.md) | | [optional] [default to null] +**Role** | **string** | | [optional] [default to null] +**Approved** | **bool** | | [optional] [default to null] +**ParticipatedOn** | [**time.Time**](time.Time.md) | The ISO8601 timestamp of the participant's action. For approvers, this is the time of their approval. For commenters and pull request reviewers who are not approvers, this is the time they last commented, or null if they have not commented. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Pipeline.md b/docs/Pipeline.md new file mode 100644 index 0000000..2b83601 --- /dev/null +++ b/docs/Pipeline.md @@ -0,0 +1,20 @@ +# Pipeline + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**BuildNumber** | **int32** | The build number of the pipeline. | [optional] [default to null] +**Target** | [***PipelineTarget**](pipeline_target.md) | The target that the pipeline built. | [optional] [default to null] +**Repository** | [***Repository**](repository.md) | | [optional] [default to null] +**Creator** | [***Account**](account.md) | The Bitbucket account that was used to create the pipeline. | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | The timestamp when the pipeline was created. | [optional] [default to null] +**State** | [***PipelineState**](pipeline_state.md) | | [optional] [default to null] +**Trigger** | [***PipelineTrigger**](pipeline_trigger.md) | The trigger used for the pipeline. | [optional] [default to null] +**BuildSecondsUsed** | **int32** | The number of build seconds used by this pipeline. | [optional] [default to null] +**CompletedOn** | [**time.Time**](time.Time.md) | The timestamp when the Pipeline was completed. This is not set if the pipeline is still in progress. | [optional] [default to null] +**Uuid** | **string** | The UUID identifying the pipeline. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineBuildNumber.md b/docs/PipelineBuildNumber.md new file mode 100644 index 0000000..dd0af3b --- /dev/null +++ b/docs/PipelineBuildNumber.md @@ -0,0 +1,11 @@ +# PipelineBuildNumber + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Next** | **int32** | The next number that will be used as build number. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineCommand.md b/docs/PipelineCommand.md new file mode 100644 index 0000000..f38b53b --- /dev/null +++ b/docs/PipelineCommand.md @@ -0,0 +1,12 @@ +# PipelineCommand + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Command** | **string** | The executable command. | [optional] [default to null] +**Name** | **string** | The name of the command. | [optional] [default to null] +**LogRange** | [***PipelineLogRange**](pipeline_log_range.md) | The range in the log that contains the execution output of this command. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineCommitTarget.md b/docs/PipelineCommitTarget.md new file mode 100644 index 0000000..507792d --- /dev/null +++ b/docs/PipelineCommitTarget.md @@ -0,0 +1,12 @@ +# PipelineCommitTarget + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Commit** | [***Commit**](commit.md) | | [optional] [default to null] +**Selector** | [***PipelineSelector**](pipeline_selector.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineError.md b/docs/PipelineError.md new file mode 100644 index 0000000..1a41613 --- /dev/null +++ b/docs/PipelineError.md @@ -0,0 +1,12 @@ +# PipelineError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Message** | **string** | The error message. | [optional] [default to null] +**Key** | **string** | The error key. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineImage.md b/docs/PipelineImage.md new file mode 100644 index 0000000..fa21c08 --- /dev/null +++ b/docs/PipelineImage.md @@ -0,0 +1,13 @@ +# PipelineImage + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Username** | **string** | The username needed to authenticate with the Docker registry. Only required when using a private Docker image. | [optional] [default to null] +**Password** | **string** | The password needed to authenticate with the Docker registry. Only required when using a private Docker image. | [optional] [default to null] +**Name** | **string** | The name of the image. If the image is hosted on DockerHub the short name can be used, otherwise the fully qualified name is required here. | [optional] [default to null] +**Email** | **string** | The email needed to authenticate with the Docker registry. Only required when using a private Docker image. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineKnownHost.md b/docs/PipelineKnownHost.md new file mode 100644 index 0000000..d2aa146 --- /dev/null +++ b/docs/PipelineKnownHost.md @@ -0,0 +1,13 @@ +# PipelineKnownHost + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**PublicKey** | [***PipelineSshPublicKey**](pipeline_ssh_public_key.md) | The public key of the known host. | [optional] [default to null] +**Hostname** | **string** | The hostname of the known host. | [optional] [default to null] +**Uuid** | **string** | The UUID identifying the known host. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineLogRange.md b/docs/PipelineLogRange.md new file mode 100644 index 0000000..020bbac --- /dev/null +++ b/docs/PipelineLogRange.md @@ -0,0 +1,11 @@ +# PipelineLogRange + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastBytePosition** | **int32** | The position of the last byte of the range in the log. | [optional] [default to null] +**FirstBytePosition** | **int32** | The position of the first byte of the range in the log. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineRefTarget.md b/docs/PipelineRefTarget.md new file mode 100644 index 0000000..4dfe1fc --- /dev/null +++ b/docs/PipelineRefTarget.md @@ -0,0 +1,14 @@ +# PipelineRefTarget + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Commit** | [***Commit**](commit.md) | | [optional] [default to null] +**RefType** | **string** | The type of reference (branch/tag). | [optional] [default to null] +**Selector** | [***PipelineSelector**](pipeline_selector.md) | | [optional] [default to null] +**RefName** | **string** | The name of the reference. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineSchedule.md b/docs/PipelineSchedule.md new file mode 100644 index 0000000..e64d5b4 --- /dev/null +++ b/docs/PipelineSchedule.md @@ -0,0 +1,17 @@ +# PipelineSchedule + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Uuid** | **string** | The UUID identifying the schedule. | [optional] [default to null] +**CronPattern** | **string** | The cron expression that the schedule applies. | [optional] [default to null] +**Enabled** | **bool** | Whether the schedule is enabled. | [optional] [default to null] +**Selector** | [***PipelineSelector**](pipeline_selector.md) | | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | The timestamp when the schedule was created. | [optional] [default to null] +**UpdatedOn** | [**time.Time**](time.Time.md) | The timestamp when the schedule was updated. | [optional] [default to null] +**Target** | [***PipelineTarget**](pipeline_target.md) | The target on which the schedule will be executed. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineScheduleExecution.md b/docs/PipelineScheduleExecution.md new file mode 100644 index 0000000..3e5a7f2 --- /dev/null +++ b/docs/PipelineScheduleExecution.md @@ -0,0 +1,10 @@ +# PipelineScheduleExecution + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineScheduleExecutionErrored.md b/docs/PipelineScheduleExecutionErrored.md new file mode 100644 index 0000000..928c8f5 --- /dev/null +++ b/docs/PipelineScheduleExecutionErrored.md @@ -0,0 +1,11 @@ +# PipelineScheduleExecutionErrored + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Error_** | [***PipelineError**](pipeline_error.md) | The error that caused the execution to fail. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineScheduleExecutionExecuted.md b/docs/PipelineScheduleExecutionExecuted.md new file mode 100644 index 0000000..13194ae --- /dev/null +++ b/docs/PipelineScheduleExecutionExecuted.md @@ -0,0 +1,11 @@ +# PipelineScheduleExecutionExecuted + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Pipeline** | [***Pipeline**](pipeline.md) | The pipeline that was triggered by this execution of a schedule. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineSelector.md b/docs/PipelineSelector.md new file mode 100644 index 0000000..6bdc559 --- /dev/null +++ b/docs/PipelineSelector.md @@ -0,0 +1,11 @@ +# PipelineSelector + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | The type of selector. | [default to null] +**Pattern** | **string** | The name of the matching pipeline definition. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineSshKeyPair.md b/docs/PipelineSshKeyPair.md new file mode 100644 index 0000000..5f51db1 --- /dev/null +++ b/docs/PipelineSshKeyPair.md @@ -0,0 +1,12 @@ +# PipelineSshKeyPair + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**PublicKey** | **string** | The SSH public key. | [optional] [default to null] +**PrivateKey** | **string** | The SSH private key. This value will be empty when retrieving the SSH key pair. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineSshPublicKey.md b/docs/PipelineSshPublicKey.md new file mode 100644 index 0000000..5ec8b9b --- /dev/null +++ b/docs/PipelineSshPublicKey.md @@ -0,0 +1,14 @@ +# PipelineSshPublicKey + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**KeyType** | **string** | The type of the public key. | [optional] [default to null] +**Md5Fingerprint** | **string** | The MD5 fingerprint of the public key. | [optional] [default to null] +**Sha256Fingerprint** | **string** | The SHA-256 fingerprint of the public key. | [optional] [default to null] +**Key** | **string** | The base64 encoded public key. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineState.md b/docs/PipelineState.md new file mode 100644 index 0000000..aa2b25a --- /dev/null +++ b/docs/PipelineState.md @@ -0,0 +1,10 @@ +# PipelineState + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateCompleted.md b/docs/PipelineStateCompleted.md new file mode 100644 index 0000000..8d3cfdc --- /dev/null +++ b/docs/PipelineStateCompleted.md @@ -0,0 +1,12 @@ +# PipelineStateCompleted + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of pipeline state (COMPLETED). | [optional] [default to null] +**Result** | [***PipelineStateCompletedResult**](pipeline_state_completed_result.md) | A result of a completed state of a pipeline. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateCompletedError.md b/docs/PipelineStateCompletedError.md new file mode 100644 index 0000000..42ba4a6 --- /dev/null +++ b/docs/PipelineStateCompletedError.md @@ -0,0 +1,12 @@ +# PipelineStateCompletedError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the result (ERROR) | [optional] [default to null] +**Error_** | [***PipelineError**](pipeline_error.md) | An error result of a completed state of a Bitbucket Pipeline. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateCompletedExpired.md b/docs/PipelineStateCompletedExpired.md new file mode 100644 index 0000000..74a5d5a --- /dev/null +++ b/docs/PipelineStateCompletedExpired.md @@ -0,0 +1,11 @@ +# PipelineStateCompletedExpired + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the stopped result (EXPIRED). | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateCompletedFailed.md b/docs/PipelineStateCompletedFailed.md new file mode 100644 index 0000000..d16d817 --- /dev/null +++ b/docs/PipelineStateCompletedFailed.md @@ -0,0 +1,11 @@ +# PipelineStateCompletedFailed + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the failed result (FAILED). | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateCompletedResult.md b/docs/PipelineStateCompletedResult.md new file mode 100644 index 0000000..77c984a --- /dev/null +++ b/docs/PipelineStateCompletedResult.md @@ -0,0 +1,10 @@ +# PipelineStateCompletedResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateCompletedStopped.md b/docs/PipelineStateCompletedStopped.md new file mode 100644 index 0000000..82a9e72 --- /dev/null +++ b/docs/PipelineStateCompletedStopped.md @@ -0,0 +1,11 @@ +# PipelineStateCompletedStopped + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the stopped result (STOPPED). | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateCompletedSuccessful.md b/docs/PipelineStateCompletedSuccessful.md new file mode 100644 index 0000000..52f41c7 --- /dev/null +++ b/docs/PipelineStateCompletedSuccessful.md @@ -0,0 +1,11 @@ +# PipelineStateCompletedSuccessful + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the successful result (SUCCESSFUL). | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateInProgress.md b/docs/PipelineStateInProgress.md new file mode 100644 index 0000000..66e767c --- /dev/null +++ b/docs/PipelineStateInProgress.md @@ -0,0 +1,12 @@ +# PipelineStateInProgress + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of pipeline state (IN_PROGRESS). | [optional] [default to null] +**Stage** | [***PipelineStateInProgressStage**](pipeline_state_in_progress_stage.md) | A stage of an in progress state of a pipeline. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateInProgressPaused.md b/docs/PipelineStateInProgressPaused.md new file mode 100644 index 0000000..ca72d9b --- /dev/null +++ b/docs/PipelineStateInProgressPaused.md @@ -0,0 +1,11 @@ +# PipelineStateInProgressPaused + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the stage (PAUSED) | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateInProgressRunning.md b/docs/PipelineStateInProgressRunning.md new file mode 100644 index 0000000..8ebabd9 --- /dev/null +++ b/docs/PipelineStateInProgressRunning.md @@ -0,0 +1,11 @@ +# PipelineStateInProgressRunning + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the stage (RUNNING) | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStateInProgressStage.md b/docs/PipelineStateInProgressStage.md new file mode 100644 index 0000000..33da04c --- /dev/null +++ b/docs/PipelineStateInProgressStage.md @@ -0,0 +1,10 @@ +# PipelineStateInProgressStage + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStatePending.md b/docs/PipelineStatePending.md new file mode 100644 index 0000000..e0f1936 --- /dev/null +++ b/docs/PipelineStatePending.md @@ -0,0 +1,11 @@ +# PipelineStatePending + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of pipeline state (PENDING). | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStep.md b/docs/PipelineStep.md new file mode 100644 index 0000000..fb24cc5 --- /dev/null +++ b/docs/PipelineStep.md @@ -0,0 +1,18 @@ +# PipelineStep + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**CompletedOn** | [**time.Time**](time.Time.md) | The timestamp when the step execution was completed. This is not set if the step is still in progress. | [optional] [default to null] +**LogByteCount** | **int32** | The amount of bytes of the log file that is available. | [optional] [default to null] +**Image** | [***PipelineImage**](pipeline_image.md) | The Docker image used as the build container for the step. | [optional] [default to null] +**StartedOn** | [**time.Time**](time.Time.md) | The timestamp when the step execution was started. This is not set when the step hasn't executed yet. | [optional] [default to null] +**ScriptCommands** | [**[]PipelineCommand**](pipeline_command.md) | The list of build commands. These commands are executed in the build container. | [optional] [default to null] +**State** | [***PipelineStepState**](pipeline_step_state.md) | The current state of the step | [optional] [default to null] +**SetupCommands** | [**[]PipelineCommand**](pipeline_command.md) | The list of commands that are executed as part of the setup phase of the build. These commands are executed outside the build container. | [optional] [default to null] +**Uuid** | **string** | The UUID identifying the step. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepError.md b/docs/PipelineStepError.md new file mode 100644 index 0000000..5afa3e2 --- /dev/null +++ b/docs/PipelineStepError.md @@ -0,0 +1,12 @@ +# PipelineStepError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Message** | **string** | The error message. | [optional] [default to null] +**Key** | **string** | The error key. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepState.md b/docs/PipelineStepState.md new file mode 100644 index 0000000..85cbeac --- /dev/null +++ b/docs/PipelineStepState.md @@ -0,0 +1,10 @@ +# PipelineStepState + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStateCompleted.md b/docs/PipelineStepStateCompleted.md new file mode 100644 index 0000000..11be59d --- /dev/null +++ b/docs/PipelineStepStateCompleted.md @@ -0,0 +1,12 @@ +# PipelineStepStateCompleted + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of pipeline step state (COMPLETED). | [optional] [default to null] +**Result** | [***PipelineStepStateCompletedResult**](pipeline_step_state_completed_result.md) | A result of a completed state of a pipeline step. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStateCompletedError.md b/docs/PipelineStepStateCompletedError.md new file mode 100644 index 0000000..3b83065 --- /dev/null +++ b/docs/PipelineStepStateCompletedError.md @@ -0,0 +1,12 @@ +# PipelineStepStateCompletedError + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the result (ERROR) | [optional] [default to null] +**Error_** | [***PipelineStepError**](pipeline_step_error.md) | An error result of a completed state of a Bitbucket Pipeline step. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStateCompletedExpired.md b/docs/PipelineStepStateCompletedExpired.md new file mode 100644 index 0000000..b9df73d --- /dev/null +++ b/docs/PipelineStepStateCompletedExpired.md @@ -0,0 +1,11 @@ +# PipelineStepStateCompletedExpired + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the result (EXPIRED) | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStateCompletedFailed.md b/docs/PipelineStepStateCompletedFailed.md new file mode 100644 index 0000000..626ecd3 --- /dev/null +++ b/docs/PipelineStepStateCompletedFailed.md @@ -0,0 +1,11 @@ +# PipelineStepStateCompletedFailed + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the result (FAILED) | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStateCompletedNotRun.md b/docs/PipelineStepStateCompletedNotRun.md new file mode 100644 index 0000000..243ac41 --- /dev/null +++ b/docs/PipelineStepStateCompletedNotRun.md @@ -0,0 +1,11 @@ +# PipelineStepStateCompletedNotRun + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the result (NOT_RUN) | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStateCompletedResult.md b/docs/PipelineStepStateCompletedResult.md new file mode 100644 index 0000000..9ecd87b --- /dev/null +++ b/docs/PipelineStepStateCompletedResult.md @@ -0,0 +1,10 @@ +# PipelineStepStateCompletedResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStateCompletedStopped.md b/docs/PipelineStepStateCompletedStopped.md new file mode 100644 index 0000000..bb9dc8f --- /dev/null +++ b/docs/PipelineStepStateCompletedStopped.md @@ -0,0 +1,11 @@ +# PipelineStepStateCompletedStopped + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the result (STOPPED) | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStateCompletedSuccessful.md b/docs/PipelineStepStateCompletedSuccessful.md new file mode 100644 index 0000000..fdd97c2 --- /dev/null +++ b/docs/PipelineStepStateCompletedSuccessful.md @@ -0,0 +1,11 @@ +# PipelineStepStateCompletedSuccessful + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of the result (SUCCESSFUL) | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStateInProgress.md b/docs/PipelineStepStateInProgress.md new file mode 100644 index 0000000..ee34fe0 --- /dev/null +++ b/docs/PipelineStepStateInProgress.md @@ -0,0 +1,11 @@ +# PipelineStepStateInProgress + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of pipeline step state (IN_PROGRESS). | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStatePending.md b/docs/PipelineStepStatePending.md new file mode 100644 index 0000000..ad334d3 --- /dev/null +++ b/docs/PipelineStepStatePending.md @@ -0,0 +1,11 @@ +# PipelineStepStatePending + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of pipeline step state (PENDING). | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineStepStateReady.md b/docs/PipelineStepStateReady.md new file mode 100644 index 0000000..f0e8999 --- /dev/null +++ b/docs/PipelineStepStateReady.md @@ -0,0 +1,11 @@ +# PipelineStepStateReady + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Name** | **string** | The name of pipeline step state (READY). | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineTarget.md b/docs/PipelineTarget.md new file mode 100644 index 0000000..afe6e7f --- /dev/null +++ b/docs/PipelineTarget.md @@ -0,0 +1,10 @@ +# PipelineTarget + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineTrigger.md b/docs/PipelineTrigger.md new file mode 100644 index 0000000..a2d6778 --- /dev/null +++ b/docs/PipelineTrigger.md @@ -0,0 +1,10 @@ +# PipelineTrigger + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineTriggerManual.md b/docs/PipelineTriggerManual.md new file mode 100644 index 0000000..ddad178 --- /dev/null +++ b/docs/PipelineTriggerManual.md @@ -0,0 +1,10 @@ +# PipelineTriggerManual + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineTriggerPush.md b/docs/PipelineTriggerPush.md new file mode 100644 index 0000000..cc07f93 --- /dev/null +++ b/docs/PipelineTriggerPush.md @@ -0,0 +1,10 @@ +# PipelineTriggerPush + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelineVariable.md b/docs/PipelineVariable.md new file mode 100644 index 0000000..acd9f30 --- /dev/null +++ b/docs/PipelineVariable.md @@ -0,0 +1,14 @@ +# PipelineVariable + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Value** | **string** | The value of the variable. If the variable is secured, this will be empty. | [optional] [default to null] +**Secured** | **bool** | If true, this variable will be treated as secured. The value will never be exposed in the logs or the REST API. | [optional] [default to null] +**Uuid** | **string** | The UUID identifying the variable. | [optional] [default to null] +**Key** | **string** | The unique name of the variable. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PipelinesApi.md b/docs/PipelinesApi.md new file mode 100644 index 0000000..26b17c5 --- /dev/null +++ b/docs/PipelinesApi.md @@ -0,0 +1,1220 @@ +# \PipelinesApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreatePipelineForRepository**](PipelinesApi.md#CreatePipelineForRepository) | **Post** /repositories/{username}/{repo_slug}/pipelines/ | +[**CreatePipelineVariableForTeam**](PipelinesApi.md#CreatePipelineVariableForTeam) | **Post** /teams/{username}/pipelines_config/variables/ | +[**CreatePipelineVariableForUser**](PipelinesApi.md#CreatePipelineVariableForUser) | **Post** /users/{username}/pipelines_config/variables/ | +[**CreateRepositoryPipelineKnownHost**](PipelinesApi.md#CreateRepositoryPipelineKnownHost) | **Post** /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/ | +[**CreateRepositoryPipelineSchedule**](PipelinesApi.md#CreateRepositoryPipelineSchedule) | **Post** /repositories/{username}/{repo_slug}/pipelines_config/schedules/ | +[**CreateRepositoryPipelineVariable**](PipelinesApi.md#CreateRepositoryPipelineVariable) | **Post** /repositories/{username}/{repo_slug}/pipelines_config/variables/ | +[**DeletePipelineVariableForTeam**](PipelinesApi.md#DeletePipelineVariableForTeam) | **Delete** /teams/{username}/pipelines_config/variables/{variable_uuid} | +[**DeletePipelineVariableForUser**](PipelinesApi.md#DeletePipelineVariableForUser) | **Delete** /users/{username}/pipelines_config/variables/{variable_uuid} | +[**DeleteRepositoryPipelineKeyPair**](PipelinesApi.md#DeleteRepositoryPipelineKeyPair) | **Delete** /repositories/{username}/{repo_slug}/pipelines_config/ssh/key_pair | +[**DeleteRepositoryPipelineKnownHost**](PipelinesApi.md#DeleteRepositoryPipelineKnownHost) | **Delete** /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid} | +[**DeleteRepositoryPipelineSchedule**](PipelinesApi.md#DeleteRepositoryPipelineSchedule) | **Delete** /repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid} | +[**DeleteRepositoryPipelineVariable**](PipelinesApi.md#DeleteRepositoryPipelineVariable) | **Delete** /repositories/{username}/{repo_slug}/pipelines_config/variables/{variable_uuid} | +[**GetPipelineForRepository**](PipelinesApi.md#GetPipelineForRepository) | **Get** /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid} | +[**GetPipelineStepForRepository**](PipelinesApi.md#GetPipelineStepForRepository) | **Get** /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid} | +[**GetPipelineStepLogForRepository**](PipelinesApi.md#GetPipelineStepLogForRepository) | **Get** /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/log | +[**GetPipelineStepsForRepository**](PipelinesApi.md#GetPipelineStepsForRepository) | **Get** /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/ | +[**GetPipelineVariableForTeam**](PipelinesApi.md#GetPipelineVariableForTeam) | **Get** /teams/{username}/pipelines_config/variables/{variable_uuid} | +[**GetPipelineVariableForUser**](PipelinesApi.md#GetPipelineVariableForUser) | **Get** /users/{username}/pipelines_config/variables/{variable_uuid} | +[**GetPipelineVariablesForTeam**](PipelinesApi.md#GetPipelineVariablesForTeam) | **Get** /teams/{username}/pipelines_config/variables/ | +[**GetPipelineVariablesForUser**](PipelinesApi.md#GetPipelineVariablesForUser) | **Get** /users/{username}/pipelines_config/variables/ | +[**GetPipelinesForRepository**](PipelinesApi.md#GetPipelinesForRepository) | **Get** /repositories/{username}/{repo_slug}/pipelines/ | +[**GetRepositoryPipelineConfig**](PipelinesApi.md#GetRepositoryPipelineConfig) | **Get** /repositories/{username}/{repo_slug}/pipelines_config | +[**GetRepositoryPipelineKnownHost**](PipelinesApi.md#GetRepositoryPipelineKnownHost) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid} | +[**GetRepositoryPipelineKnownHosts**](PipelinesApi.md#GetRepositoryPipelineKnownHosts) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/ | +[**GetRepositoryPipelineSchedule**](PipelinesApi.md#GetRepositoryPipelineSchedule) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid} | +[**GetRepositoryPipelineScheduleExecutions**](PipelinesApi.md#GetRepositoryPipelineScheduleExecutions) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}/executions/ | +[**GetRepositoryPipelineSchedules**](PipelinesApi.md#GetRepositoryPipelineSchedules) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/schedules/ | +[**GetRepositoryPipelineSshKeyPair**](PipelinesApi.md#GetRepositoryPipelineSshKeyPair) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/ssh/key_pair | +[**GetRepositoryPipelineVariable**](PipelinesApi.md#GetRepositoryPipelineVariable) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/variables/{variable_uuid} | +[**GetRepositoryPipelineVariables**](PipelinesApi.md#GetRepositoryPipelineVariables) | **Get** /repositories/{username}/{repo_slug}/pipelines_config/variables/ | +[**StopPipeline**](PipelinesApi.md#StopPipeline) | **Post** /repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/stopPipeline | +[**UpdatePipelineVariableForTeam**](PipelinesApi.md#UpdatePipelineVariableForTeam) | **Put** /teams/{username}/pipelines_config/variables/{variable_uuid} | +[**UpdatePipelineVariableForUser**](PipelinesApi.md#UpdatePipelineVariableForUser) | **Put** /users/{username}/pipelines_config/variables/{variable_uuid} | +[**UpdateRepositoryBuildNumber**](PipelinesApi.md#UpdateRepositoryBuildNumber) | **Put** /repositories/{username}/{repo_slug}/pipelines_config/build_number | +[**UpdateRepositoryPipelineConfig**](PipelinesApi.md#UpdateRepositoryPipelineConfig) | **Put** /repositories/{username}/{repo_slug}/pipelines_config | +[**UpdateRepositoryPipelineKeyPair**](PipelinesApi.md#UpdateRepositoryPipelineKeyPair) | **Put** /repositories/{username}/{repo_slug}/pipelines_config/ssh/key_pair | +[**UpdateRepositoryPipelineKnownHost**](PipelinesApi.md#UpdateRepositoryPipelineKnownHost) | **Put** /repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid} | +[**UpdateRepositoryPipelineSchedule**](PipelinesApi.md#UpdateRepositoryPipelineSchedule) | **Put** /repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid} | +[**UpdateRepositoryPipelineVariable**](PipelinesApi.md#UpdateRepositoryPipelineVariable) | **Put** /repositories/{username}/{repo_slug}/pipelines_config/variables/{variable_uuid} | + + +# **CreatePipelineForRepository** +> Pipeline CreatePipelineForRepository(ctx, username, repoSlug, body) + + +Endpoint to create and initiate a pipeline. There are a couple of different options to initiate a pipeline, where the payload of the request will determine which type of pipeline will be instantiated. # Trigger a Pipeline for a branch or tag One way to trigger pipelines is by specifying the reference for which you want to trigger a pipeline (e.g. a branch or tag). The specified reference will be used to determine which pipeline definition from the `bitbucket-pipelines.yml` file will be applied to initiate the pipeline. The pipeline will then do a clone of the repository and checkout the latest revision of the specified reference. ### Example ``` $ curl -X POST -is -u username:password \\ -H 'Content-Type: application/json' \\ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \\ -d ' { \"target\": { \"ref_type\": \"branch\", \"type\": \"pipeline_ref_target\", \"ref_name\": \"master\" } }' ``` # Trigger a Pipeline for a commit on a branch or tag You can initiate a pipeline for a specific commit and in the context of a specified reference (e.g. a branch, tag or bookmark). The specified reference will be used to determine which pipeline definition from the bitbucket-pipelines.yml file will be applied to initiate the pipeline. The pipeline will clone the repository and then do a checkout the specified reference. The following reference types are supported: * `branch` * `named_branch` * `bookmark` * `tag` ### Example ``` $ curl -X POST -is -u username:password \\ -H 'Content-Type: application/json' \\ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \\ -d ' { \"target\": { \"commit\": { \"type\": \"commit\", \"hash\": \"ce5b7431602f7cbba007062eeb55225c6e18e956\" }, \"ref_type\": \"branch\", \"type\": \"pipeline_ref_target\", \"ref_name\": \"master\" } }' ``` # Trigger a specific pipeline definition for a commit You can trigger a specific pipeline that is defined in your `bitbucket-pipelines.yml` file for a specific commit. In addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition. The resulting pipeline will then clone the repository and checkout the specified revision. ### Example ``` $ curl -X POST -is -u username:password \\ -H 'Content-Type: application/json' \\ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \\ -d ' { \"target\": { \"commit\": { \"hash\":\"a3c4e02c9a3755eccdc3764e6ea13facdf30f923\", \"type\":\"commit\" }, \"selector\": { \"type\":\"custom\", \"pattern\":\"Deploy to production\" }, \"type\":\"pipeline_commit_target\" } }' ``` # Trigger a specific pipeline definition for a commit on a branch or tag You can trigger a specific pipeline that is defined in your `bitbucket-pipelines.yml` file for a specific commit in the context of a specified reference. In addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition, as well as the reference information. The resulting pipeline will then clone the repository a checkout the specified reference. ### Example ``` $ curl -X POST -is -u username:password \\ -H 'Content-Type: application/json' \\ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \\ -d ' { \"target\": { \"commit\": { \"hash\":\"a3c4e02c9a3755eccdc3764e6ea13facdf30f923\", \"type\":\"commit\" }, \"selector\": { \"type\": \"custom\", \"pattern\": \"Deploy to production\" }, \"type\": \"pipeline_ref_target\", \"ref_name\": \"master\", \"ref_type\": \"branch\" } }' ``` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **body** | [**Pipeline**](Pipeline.md)| The pipeline to initiate. | + +### Return type + +[**Pipeline**](pipeline.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **CreatePipelineVariableForTeam** +> PipelineVariable CreatePipelineVariableForTeam(ctx, username, optional) + + +Create an account level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The account. | + **body** | [**PipelineVariable**](PipelineVariable.md)| The variable to create. | + +### Return type + +[**PipelineVariable**](pipeline_variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **CreatePipelineVariableForUser** +> PipelineVariable CreatePipelineVariableForUser(ctx, username, optional) + + +Create a user level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The account. | + **body** | [**PipelineVariable**](PipelineVariable.md)| The variable to create. | + +### Return type + +[**PipelineVariable**](pipeline_variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **CreateRepositoryPipelineKnownHost** +> PipelineKnownHost CreateRepositoryPipelineKnownHost(ctx, username, repoSlug, body) + + +Create a repository level known host. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **body** | [**PipelineKnownHost**](PipelineKnownHost.md)| The known host to create. | + +### Return type + +[**PipelineKnownHost**](pipeline_known_host.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **CreateRepositoryPipelineSchedule** +> PipelineSchedule CreateRepositoryPipelineSchedule(ctx, username, repoSlug, body) + + +Create a schedule for the given repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **body** | [**PipelineSchedule**](PipelineSchedule.md)| The schedule to create. | + +### Return type + +[**PipelineSchedule**](pipeline_schedule.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **CreateRepositoryPipelineVariable** +> PipelineVariable CreateRepositoryPipelineVariable(ctx, username, repoSlug, body) + + +Create a repository level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **body** | [**PipelineVariable**](PipelineVariable.md)| The variable to create. | + +### Return type + +[**PipelineVariable**](pipeline_variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **DeletePipelineVariableForTeam** +> DeletePipelineVariableForTeam(ctx, username, variableUuid) + + +Delete a team level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **variableUuid** | **string**| The UUID of the variable to delete. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **DeletePipelineVariableForUser** +> DeletePipelineVariableForUser(ctx, username, variableUuid) + + +Delete an account level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **variableUuid** | **string**| The UUID of the variable to delete. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **DeleteRepositoryPipelineKeyPair** +> DeleteRepositoryPipelineKeyPair(ctx, username, repoSlug) + + +Delete the repository SSH key pair. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **DeleteRepositoryPipelineKnownHost** +> DeleteRepositoryPipelineKnownHost(ctx, username, repoSlug, knownHostUuid) + + +Delete a repository level known host. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **knownHostUuid** | **string**| The UUID of the known host to delete. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **DeleteRepositoryPipelineSchedule** +> DeleteRepositoryPipelineSchedule(ctx, username, repoSlug, scheduleUuid) + + +Delete a schedule. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **scheduleUuid** | **string**| The uuid of the schedule. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **DeleteRepositoryPipelineVariable** +> DeleteRepositoryPipelineVariable(ctx, username, repoSlug, variableUuid) + + +Delete a repository level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **variableUuid** | **string**| The UUID of the variable to delete. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetPipelineForRepository** +> Pipeline GetPipelineForRepository(ctx, username, repoSlug, pipelineUuid) + + +Retrieve a specified pipeline + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **pipelineUuid** | **string**| The pipeline UUID. | + +### Return type + +[**Pipeline**](pipeline.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetPipelineStepForRepository** +> PipelineStep GetPipelineStepForRepository(ctx, username, repoSlug, pipelineUuid, stepUuid) + + +Retrieve a given step of a pipeline. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **pipelineUuid** | **string**| The UUID of the pipeline. | + **stepUuid** | **string**| The UUID of the step. | + +### Return type + +[**PipelineStep**](pipeline_step.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetPipelineStepLogForRepository** +> GetPipelineStepLogForRepository(ctx, username, repoSlug, pipelineUuid, stepUuid) + + +Retrieve the log file for a given step of a pipeline. This endpoint supports (and encourages!) the use of [HTTP Range requests](https://tools.ietf.org/html/rfc7233) to deal with potentially very large log files. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **pipelineUuid** | **string**| The UUID of the pipeline. | + **stepUuid** | **string**| The UUID of the step. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/octet-stream + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetPipelineStepsForRepository** +> PaginatedPipelineSteps GetPipelineStepsForRepository(ctx, username, repoSlug, pipelineUuid) + + +Find steps for the given pipeline. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **pipelineUuid** | **string**| The UUID of the pipeline. | + +### Return type + +[**PaginatedPipelineSteps**](paginated_pipeline_steps.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetPipelineVariableForTeam** +> PipelineVariable GetPipelineVariableForTeam(ctx, username, variableUuid) + + +Retrieve a team level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **variableUuid** | **string**| The UUID of the variable to retrieve. | + +### Return type + +[**PipelineVariable**](pipeline_variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetPipelineVariableForUser** +> PipelineVariable GetPipelineVariableForUser(ctx, username, variableUuid) + + +Retrieve a user level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **variableUuid** | **string**| The UUID of the variable to retrieve. | + +### Return type + +[**PipelineVariable**](pipeline_variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetPipelineVariablesForTeam** +> PaginatedPipelineVariables GetPipelineVariablesForTeam(ctx, username) + + +Find account level variables. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + +### Return type + +[**PaginatedPipelineVariables**](paginated_pipeline_variables.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetPipelineVariablesForUser** +> PaginatedPipelineVariables GetPipelineVariablesForUser(ctx, username) + + +Find user level variables. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + +### Return type + +[**PaginatedPipelineVariables**](paginated_pipeline_variables.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetPipelinesForRepository** +> PaginatedPipelines GetPipelinesForRepository(ctx, username, repoSlug) + + +Find pipelines + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + +### Return type + +[**PaginatedPipelines**](paginated_pipelines.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetRepositoryPipelineConfig** +> PipelinesConfig GetRepositoryPipelineConfig(ctx, username, repoSlug) + + +Retrieve the repository pipelines configuration. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + +### Return type + +[**PipelinesConfig**](pipelines_config.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetRepositoryPipelineKnownHost** +> PipelineKnownHost GetRepositoryPipelineKnownHost(ctx, username, repoSlug, knownHostUuid) + + +Retrieve a repository level known host. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **knownHostUuid** | **string**| The UUID of the known host to retrieve. | + +### Return type + +[**PipelineKnownHost**](pipeline_known_host.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetRepositoryPipelineKnownHosts** +> PaginatedPipelineKnownHosts GetRepositoryPipelineKnownHosts(ctx, username, repoSlug) + + +Find repository level known hosts. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + +### Return type + +[**PaginatedPipelineKnownHosts**](paginated_pipeline_known_hosts.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetRepositoryPipelineSchedule** +> PipelineSchedule GetRepositoryPipelineSchedule(ctx, username, repoSlug, scheduleUuid) + + +Retrieve a schedule by its UUID. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **scheduleUuid** | **string**| The uuid of the schedule. | + +### Return type + +[**PipelineSchedule**](pipeline_schedule.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetRepositoryPipelineScheduleExecutions** +> PaginatedPipelineScheduleExecutions GetRepositoryPipelineScheduleExecutions(ctx, username, repoSlug) + + +Retrieve the executions of a given schedule. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + +### Return type + +[**PaginatedPipelineScheduleExecutions**](paginated_pipeline_schedule_executions.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetRepositoryPipelineSchedules** +> PaginatedPipelineSchedules GetRepositoryPipelineSchedules(ctx, username, repoSlug) + + +Retrieve the configured schedules for the given repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + +### Return type + +[**PaginatedPipelineSchedules**](paginated_pipeline_schedules.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetRepositoryPipelineSshKeyPair** +> PipelineSshKeyPair GetRepositoryPipelineSshKeyPair(ctx, username, repoSlug) + + +Retrieve the repository SSH key pair excluding the SSH private key. The private key is a write only field and will never be exposed in the logs or the REST API. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + +### Return type + +[**PipelineSshKeyPair**](pipeline_ssh_key_pair.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetRepositoryPipelineVariable** +> PipelineVariable GetRepositoryPipelineVariable(ctx, username, repoSlug, variableUuid) + + +Retrieve a repository level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **variableUuid** | **string**| The UUID of the variable to retrieve. | + +### Return type + +[**PipelineVariable**](pipeline_variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetRepositoryPipelineVariables** +> PaginatedPipelineVariables GetRepositoryPipelineVariables(ctx, username, repoSlug) + + +Find repository level variables. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + +### Return type + +[**PaginatedPipelineVariables**](paginated_pipeline_variables.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **StopPipeline** +> StopPipeline(ctx, username, repoSlug, pipelineUuid) + + +Signal the stop of a pipeline and all of its steps that not have completed yet. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **pipelineUuid** | **string**| The UUID of the pipeline. | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UpdatePipelineVariableForTeam** +> PipelineVariable UpdatePipelineVariableForTeam(ctx, username, variableUuid, body) + + +Update a team level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **variableUuid** | **string**| The UUID of the variable. | + **body** | [**PipelineVariable**](PipelineVariable.md)| The updated variable. | + +### Return type + +[**PipelineVariable**](pipeline_variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UpdatePipelineVariableForUser** +> PipelineVariable UpdatePipelineVariableForUser(ctx, username, variableUuid, body) + + +Update a user level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **variableUuid** | **string**| The UUID of the variable. | + **body** | [**PipelineVariable**](PipelineVariable.md)| The updated variable. | + +### Return type + +[**PipelineVariable**](pipeline_variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UpdateRepositoryBuildNumber** +> PipelineBuildNumber UpdateRepositoryBuildNumber(ctx, username, repoSlug, body) + + +Update the next build number that should be assigned to a pipeline. The next build number that will be configured has to be strictly higher than the current latest build number for this repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **body** | [**PipelineBuildNumber**](PipelineBuildNumber.md)| The build number to update. | + +### Return type + +[**PipelineBuildNumber**](pipeline_build_number.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UpdateRepositoryPipelineConfig** +> PipelinesConfig UpdateRepositoryPipelineConfig(ctx, username, repoSlug, body) + + +Update the pipelines configuration for a repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **body** | [**PipelinesConfig**](PipelinesConfig.md)| The updated repository pipelines configuration. | + +### Return type + +[**PipelinesConfig**](pipelines_config.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UpdateRepositoryPipelineKeyPair** +> PipelineSshKeyPair UpdateRepositoryPipelineKeyPair(ctx, username, repoSlug, body) + + +Create or update the repository SSH key pair. The private key will be set as a default SSH identity in your build container. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **body** | [**PipelineSshKeyPair**](PipelineSshKeyPair.md)| The created or updated SSH key pair. | + +### Return type + +[**PipelineSshKeyPair**](pipeline_ssh_key_pair.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UpdateRepositoryPipelineKnownHost** +> PipelineKnownHost UpdateRepositoryPipelineKnownHost(ctx, username, repoSlug, knownHostUuid, body) + + +Update a repository level known host. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **knownHostUuid** | **string**| The UUID of the known host to update. | + **body** | [**PipelineKnownHost**](PipelineKnownHost.md)| The updated known host. | + +### Return type + +[**PipelineKnownHost**](pipeline_known_host.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UpdateRepositoryPipelineSchedule** +> PipelineSchedule UpdateRepositoryPipelineSchedule(ctx, username, repoSlug, scheduleUuid, body) + + +Update a schedule. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **scheduleUuid** | **string**| The uuid of the schedule. | + **body** | [**PipelineSchedule**](PipelineSchedule.md)| The schedule to update. | + +### Return type + +[**PipelineSchedule**](pipeline_schedule.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UpdateRepositoryPipelineVariable** +> PipelineVariable UpdateRepositoryPipelineVariable(ctx, username, repoSlug, variableUuid, body) + + +Update a repository level variable. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account. | + **repoSlug** | **string**| The repository. | + **variableUuid** | **string**| The UUID of the variable to update. | + **body** | [**PipelineVariable**](PipelineVariable.md)| The updated variable | + +### Return type + +[**PipelineVariable**](pipeline_variable.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/PipelinesConfig.md b/docs/PipelinesConfig.md new file mode 100644 index 0000000..4fffd48 --- /dev/null +++ b/docs/PipelinesConfig.md @@ -0,0 +1,12 @@ +# PipelinesConfig + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Enabled** | **bool** | Whether Pipelines is enabled for the repository. | [optional] [default to null] +**Repository** | [***Repository**](repository.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Project.md b/docs/Project.md new file mode 100644 index 0000000..96e4697 --- /dev/null +++ b/docs/Project.md @@ -0,0 +1,19 @@ +# Project + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***ProjectLinks**](project_links.md) | | [optional] [default to null] +**Uuid** | **string** | The project's immutable id. | [optional] [default to null] +**Key** | **string** | The project's key. | [optional] [default to null] +**Owner** | [***Team**](team.md) | | [optional] [default to null] +**Name** | **string** | The name of the project. | [optional] [default to null] +**Description** | **string** | | [optional] [default to null] +**IsPrivate** | **bool** | Indicates whether the project is publicly accessible, or whether it is private to the team and consequently only visible to team members. Note that private projects cannot contain public repositories. | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**UpdatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ProjectLinks.md b/docs/ProjectLinks.md new file mode 100644 index 0000000..d7cbf21 --- /dev/null +++ b/docs/ProjectLinks.md @@ -0,0 +1,11 @@ +# ProjectLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Html** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Avatar** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ProjectsApi.md b/docs/ProjectsApi.md new file mode 100644 index 0000000..3d72670 --- /dev/null +++ b/docs/ProjectsApi.md @@ -0,0 +1,158 @@ +# \ProjectsApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TeamsUsernameProjectsGet**](ProjectsApi.md#TeamsUsernameProjectsGet) | **Get** /teams/{username}/projects/ | +[**TeamsUsernameProjectsPost**](ProjectsApi.md#TeamsUsernameProjectsPost) | **Post** /teams/{username}/projects/ | +[**TeamsUsernameProjectsProjectKeyDelete**](ProjectsApi.md#TeamsUsernameProjectsProjectKeyDelete) | **Delete** /teams/{username}/projects/{project_key} | +[**TeamsUsernameProjectsProjectKeyGet**](ProjectsApi.md#TeamsUsernameProjectsProjectKeyGet) | **Get** /teams/{username}/projects/{project_key} | +[**TeamsUsernameProjectsProjectKeyPut**](ProjectsApi.md#TeamsUsernameProjectsProjectKeyPut) | **Put** /teams/{username}/projects/{project_key} | + + +# **TeamsUsernameProjectsGet** +> PaginatedProjects TeamsUsernameProjectsGet(ctx, username) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The team which owns the project. This can either be the `username` of the team or the `UUID` of the team (surrounded by curly-braces (`{}`)). | + +### Return type + +[**PaginatedProjects**](paginated_projects.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameProjectsPost** +> Project TeamsUsernameProjectsPost(ctx, username, body) + + +Creates a new project. Note that the avatar has to be embedded as either a data-url or a URL to an external image as shown in the examples below: ``` $ body=$(cat << EOF { \"name\": \"Mars Project\", \"key\": \"MARS\", \"description\": \"Software for colonizing mars.\", \"links\": { \"avatar\": { \"href\": \"data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/...\" } }, \"is_private\": false } EOF ) $ curl -H \"Content-Type: application/json\" \\ -X POST \\ -d \"$body\" \\ https://api.bitbucket.org/2.0/teams/teams-in-space/projects/ | jq . { // Serialized project document } ``` or even: ``` $ body=$(cat << EOF { \"name\": \"Mars Project\", \"key\": \"MARS\", \"description\": \"Software for colonizing mars.\", \"links\": { \"avatar\": { \"href\": \"http://i.imgur.com/72tRx4w.gif\" } }, \"is_private\": false } EOF ) $ curl -H \"Content-Type: application/json\" \\ -X POST \\ -d \"$body\" \\ https://api.bitbucket.org/2.0/teams/teams-in-space/projects/ | jq . { // Serialized project document } ``` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The team which owns the project. This can either be the `username` of the team or the `UUID` of the team (surrounded by curly-braces (`{}`)). | + **body** | [**Project**](Project.md)| | + +### Return type + +[**Project**](project.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameProjectsProjectKeyDelete** +> TeamsUsernameProjectsProjectKeyDelete(ctx, username, projectKey) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The team which owns the project. This can either be the `username` of the team or the `UUID` of the team (surrounded by curly-braces (`{}`)). | + **projectKey** | **string**| The project in question. This can either be the actual `key` assigned to the project or the `UUID` (surrounded by curly-braces (`{}`)). | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameProjectsProjectKeyGet** +> Project TeamsUsernameProjectsProjectKeyGet(ctx, username, projectKey) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The team which owns the project. This can either be the `username` of the team or the `UUID` of the team (surrounded by curly-braces (`{}`)). | + **projectKey** | **string**| The project in question. This can either be the actual `key` assigned to the project or the `UUID` (surrounded by curly-braces (`{}`)). | + +### Return type + +[**Project**](project.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameProjectsProjectKeyPut** +> Project TeamsUsernameProjectsProjectKeyPut(ctx, username, projectKey, body) + + +Since this endpoint can be used to both update and to create a project, the request body depends on the intent. ### Creation See the POST documentation for the project collection for an example of the request body. Note: The `key` should not be specified in the body of request (since it is already present in the URL). The `name` is required, everything else is optional. ### Update See the POST documentation for the project collection for an example of the request body. Note: The key is not required in the body (since it is already in the URL). The key may be specified in the body, if the intent is to change the key itself. In such a scenario, the location of the project is changed and is returned in the `Location` header of the response. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The team which owns the project. This can either be the `username` of the team or the `UUID` of the team (surrounded by curly-braces (`{}`)). | + **projectKey** | **string**| The project in question. This can either be the actual `key` assigned to the project or the `UUID` (surrounded by curly-braces (`{}`)). | + **body** | [**Project**](Project.md)| | + +### Return type + +[**Project**](project.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Pullrequest.md b/docs/Pullrequest.md new file mode 100644 index 0000000..a958124 --- /dev/null +++ b/docs/Pullrequest.md @@ -0,0 +1,28 @@ +# Pullrequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***PullrequestLinks**](pullrequest_links.md) | | [optional] [default to null] +**Id** | **int32** | The pull request's unique ID. Note that pull request IDs are only unique within their associated repository. | [optional] [default to null] +**Title** | **string** | Title of the pull request. | [optional] [default to null] +**Summary** | [***PullrequestSummary**](pullrequest_summary.md) | | [optional] [default to null] +**State** | **string** | The pull request's current status. | [optional] [default to null] +**Author** | [***Account**](account.md) | | [optional] [default to null] +**Source** | [***PullrequestEndpoint**](pullrequest_endpoint.md) | | [optional] [default to null] +**Destination** | [***PullrequestEndpoint**](pullrequest_endpoint.md) | | [optional] [default to null] +**MergeCommit** | [***PullrequestMergeCommit**](pullrequest_merge_commit.md) | | [optional] [default to null] +**CommentCount** | **int32** | The number of comments for a specific pull request. | [optional] [default to null] +**TaskCount** | **int32** | The number of open tasks for a specific pull request. | [optional] [default to null] +**CloseSourceBranch** | **bool** | A boolean flag indicating if merging the pull request closes the source branch. | [optional] [default to null] +**ClosedBy** | [***Account**](account.md) | | [optional] [default to null] +**Reason** | **string** | Explains why a pull request was declined. This field is only applicable to pull requests in rejected state. | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | The ISO8601 timestamp the request was created. | [optional] [default to null] +**UpdatedOn** | [**time.Time**](time.Time.md) | The ISO8601 timestamp the request was last updated. | [optional] [default to null] +**Reviewers** | [**[]Account**](account.md) | The list of users that were added as reviewers on this pull request when it was created. For performance reasons, the API only includes this list on a pull request's `self` URL. | [optional] [default to null] +**Participants** | [**[]Participant**](participant.md) | The list of users that are collaborating on this pull request. Collaborators are user that: * are added to the pull request as a reviewer (part of the reviewers list) * are not explicit reviewers, but have commented on the pull request * are not explicit reviewers, but have approved the pull request Each user is wrapped in an object that indicates the user's role and whether they have approved the pull request. For performance reasons, the API only returns this list when an API requests a pull request by id. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PullrequestComment.md b/docs/PullrequestComment.md new file mode 100644 index 0000000..3a0787a --- /dev/null +++ b/docs/PullrequestComment.md @@ -0,0 +1,20 @@ +# PullrequestComment + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Id** | **int32** | | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**UpdatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Content** | [***PullrequestSummary**](pullrequest_summary.md) | | [optional] [default to null] +**User** | [***User**](user.md) | | [optional] [default to null] +**Deleted** | **bool** | | [optional] [default to null] +**Parent** | [***Comment**](comment.md) | | [optional] [default to null] +**Inline** | [***CommentInline**](comment_inline.md) | | [optional] [default to null] +**Links** | [***CommentLinks**](comment_links.md) | | [optional] [default to null] +**PullRequest** | [***Pullrequest**](pullrequest.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PullrequestEndpoint.md b/docs/PullrequestEndpoint.md new file mode 100644 index 0000000..6eae090 --- /dev/null +++ b/docs/PullrequestEndpoint.md @@ -0,0 +1,12 @@ +# PullrequestEndpoint + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Repository** | [***Repository**](repository.md) | | [optional] [default to null] +**Branch** | [***PullrequestEndpointBranch**](pullrequest_endpoint_branch.md) | | [optional] [default to null] +**Commit** | [***PullrequestMergeCommit**](pullrequest_merge_commit.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PullrequestEndpointBranch.md b/docs/PullrequestEndpointBranch.md new file mode 100644 index 0000000..5154313 --- /dev/null +++ b/docs/PullrequestEndpointBranch.md @@ -0,0 +1,10 @@ +# PullrequestEndpointBranch + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PullrequestLinks.md b/docs/PullrequestLinks.md new file mode 100644 index 0000000..614b967 --- /dev/null +++ b/docs/PullrequestLinks.md @@ -0,0 +1,18 @@ +# PullrequestLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Html** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Commits** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Approve** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Diff** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Comments** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Activity** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Merge** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Decline** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PullrequestMergeCommit.md b/docs/PullrequestMergeCommit.md new file mode 100644 index 0000000..f301f01 --- /dev/null +++ b/docs/PullrequestMergeCommit.md @@ -0,0 +1,10 @@ +# PullrequestMergeCommit + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Hash** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PullrequestMergeParameters.md b/docs/PullrequestMergeParameters.md new file mode 100644 index 0000000..f58e3a0 --- /dev/null +++ b/docs/PullrequestMergeParameters.md @@ -0,0 +1,13 @@ +# PullrequestMergeParameters + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Message** | **string** | The commit message that will be used on the resulting commit. | [optional] [default to null] +**CloseSourceBranch** | **bool** | Whether the source branch should be deleted. If this is not provided, we fallback to the value used when the pull request was created, which defaults to False | [optional] [default to null] +**MergeStrategy** | **string** | The merge strategy that will be used to merge the pull request. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PullrequestSummary.md b/docs/PullrequestSummary.md new file mode 100644 index 0000000..a296e2c --- /dev/null +++ b/docs/PullrequestSummary.md @@ -0,0 +1,12 @@ +# PullrequestSummary + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Raw** | **string** | The text as it was typed by a user. | [optional] [default to null] +**Markup** | **string** | The type of markup language the raw content is to be interpreted in. | [optional] [default to null] +**Html** | **string** | The user's content rendered as HTML. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PullrequestsApi.md b/docs/PullrequestsApi.md new file mode 100644 index 0000000..56e1868 --- /dev/null +++ b/docs/PullrequestsApi.md @@ -0,0 +1,668 @@ +# \PullrequestsApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**RepositoriesUsernameRepoSlugDefaultReviewersGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugDefaultReviewersGet) | **Get** /repositories/{username}/{repo_slug}/default-reviewers | +[**RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameDelete**](PullrequestsApi.md#RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameDelete) | **Delete** /repositories/{username}/{repo_slug}/default-reviewers/{target_username} | +[**RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameGet) | **Get** /repositories/{username}/{repo_slug}/default-reviewers/{target_username} | +[**RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernamePut**](PullrequestsApi.md#RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernamePut) | **Put** /repositories/{username}/{repo_slug}/default-reviewers/{target_username} | +[**RepositoriesUsernameRepoSlugPullrequestsActivityGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsActivityGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/activity | +[**RepositoriesUsernameRepoSlugPullrequestsGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests | +[**RepositoriesUsernameRepoSlugPullrequestsPost**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPost) | **Post** /repositories/{username}/{repo_slug}/pullrequests | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdActivityGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdActivityGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/activity | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApproveDelete**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApproveDelete) | **Delete** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/approve | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApprovePost**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApprovePost) | **Post** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/approve | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsCommentIdGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsCommentIdGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id} | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/comments | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommitsGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommitsGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/commits | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDeclinePost**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDeclinePost) | **Post** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/decline | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDiffGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDiffGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/diff | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id} | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdMergePost**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdMergePost) | **Post** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/merge | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPatchGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPatchGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/patch | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPut**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPut) | **Put** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id} | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet**](PullrequestsApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/statuses | + + +# **RepositoriesUsernameRepoSlugDefaultReviewersGet** +> RepositoriesUsernameRepoSlugDefaultReviewersGet(ctx, username, repoSlug) + + +Returns the repository's default reviewers. These are the users that are automatically added as reviewers on every new pull request that is created. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameDelete** +> ModelError RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameDelete(ctx, username, targetUsername, repoSlug) + + +Removes a default reviewer from the repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **targetUsername** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameGet** +> ModelError RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameGet(ctx, username, targetUsername, repoSlug) + + +Returns the specified reviewer. This can be used to test whether a user is among the repository's default reviewers list. A 404 indicates that that specified user is not a default reviewer. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **targetUsername** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernamePut** +> ModelError RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernamePut(ctx, username, targetUsername, repoSlug) + + +Adds the specified user to the repository's list of default reviewers. This method is idempotent. Adding a user a second time has no effect. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **targetUsername** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsActivityGet** +> RepositoriesUsernameRepoSlugPullrequestsActivityGet(ctx, username, repoSlug, pullRequestId) + + +Returns a paginated list of the pull request's activity log. This includes comments that were made by the reviewers, updates and approvals. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **pullRequestId** | **int32**| The id of the pull request. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsGet** +> PaginatedPullrequests RepositoriesUsernameRepoSlugPullrequestsGet(ctx, username, repoSlug, optional) + + +Returns a paginated list of all pull requests on the specified repository. By default only open pull requests are returned. This can be controlled using the `state` query parameter. To retrieve pull requests that are in one of multiple states, repeat the `state` parameter for each individual state. This endpoint also supports filtering and sorting of the results. See [filtering and sorting](../../../../meta/filtering) for more details. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **state** | **string**| Only return pull requests that are in this state. This parameter can be repeated. | + +### Return type + +[**PaginatedPullrequests**](paginated_pullrequests.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPost** +> Pullrequest RepositoriesUsernameRepoSlugPullrequestsPost(ctx, username, repoSlug, optional) + + +Creates a new pull request. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **body** | [**Pullrequest**](Pullrequest.md)| The new pull request. The request URL you POST to becomes the destination repository URL. For this reason, you must specify an explicit source repository in the request object if you want to pull from a different repository (fork). Since not all elements are required or even mutable, you only need to include the elements you want to initialize, such as the source branch and the title. | + +### Return type + +[**Pullrequest**](pullrequest.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdActivityGet** +> RepositoriesUsernameRepoSlugPullrequestsPullRequestIdActivityGet(ctx, username, repoSlug, pullRequestId) + + +Returns a paginated list of the pull request's activity log. This includes comments that were made by the reviewers, updates and approvals. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **pullRequestId** | **int32**| The id of the pull request. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApproveDelete** +> RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApproveDelete(ctx, username, pullRequestId, repoSlug) + + +Redact the authenticated user's approval of the specified pull request. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **pullRequestId** | **string**| | + **repoSlug** | **string**| | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApprovePost** +> Participant RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApprovePost(ctx, username, pullRequestId, repoSlug) + + +Approve the specified pull request as the authenticated user. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **pullRequestId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**Participant**](participant.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsCommentIdGet** +> PullrequestComment RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsCommentIdGet(ctx, username, pullRequestId, commentId, repoSlug) + + +Returns a specific pull request comment. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **pullRequestId** | **string**| | + **commentId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**PullrequestComment**](pullrequest_comment.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsGet** +> PaginatedPullrequestComments RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsGet(ctx, username, repoSlug, pullRequestId) + + +Returns a paginated list of the pull request's comments. This includes both global, inline comments and replies. The default sorting is oldest to newest and can be overridden with the `sort` query parameter. This endpoint also supports filtering and sorting of the results. See [filtering and sorting](../../../../../../meta/filtering) for more details. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the account, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **pullRequestId** | **int32**| The id of the pull request. | + +### Return type + +[**PaginatedPullrequestComments**](paginated_pullrequest_comments.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommitsGet** +> ModelError RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommitsGet(ctx, username, pullRequestId, repoSlug) + + +Returns a paginated list of the pull request's commits. These are the commits that are being merged into the destination branch when the pull requests gets accepted. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **pullRequestId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDeclinePost** +> Pullrequest RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDeclinePost(ctx, username, pullRequestId, repoSlug) + + +Declines the pull request. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **pullRequestId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**Pullrequest**](pullrequest.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDiffGet** +> ModelError RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDiffGet(ctx, username, pullRequestId, repoSlug) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **pullRequestId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdGet** +> Pullrequest RepositoriesUsernameRepoSlugPullrequestsPullRequestIdGet(ctx, username, repoSlug, pullRequestId) + + +Returns the specified pull request. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the account, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **pullRequestId** | **int32**| The id of the pull request. | + +### Return type + +[**Pullrequest**](pullrequest.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdMergePost** +> Pullrequest RepositoriesUsernameRepoSlugPullrequestsPullRequestIdMergePost(ctx, username, pullRequestId, repoSlug, optional) + + +Merges the pull request. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **pullRequestId** | **string**| | + **repoSlug** | **string**| | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **pullRequestId** | **string**| | + **repoSlug** | **string**| | + **body** | [**PullrequestMergeParameters**](PullrequestMergeParameters.md)| | + +### Return type + +[**Pullrequest**](pullrequest.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPatchGet** +> ModelError RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPatchGet(ctx, username, pullRequestId, repoSlug) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **pullRequestId** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPut** +> Pullrequest RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPut(ctx, username, repoSlug, pullRequestId, optional) + + +Mutates the specified pull request. This can be used to change the pull request's branches or description. Only open pull requests can be mutated. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **pullRequestId** | **int32**| The id of the open pull request. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **pullRequestId** | **int32**| The id of the open pull request. | + **body** | [**Pullrequest**](Pullrequest.md)| The pull request that is to be updated. | + +### Return type + +[**Pullrequest**](pullrequest.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet** +> PaginatedCommitstatuses RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet(ctx, username, repoSlug, pullRequestId) + + +Returns all statuses (e.g. build results) for the given pull request. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **pullRequestId** | **int32**| The pull request's id | + +### Return type + +[**PaginatedCommitstatuses**](paginated_commitstatuses.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/RefsApi.md b/docs/RefsApi.md new file mode 100644 index 0000000..d46b277 --- /dev/null +++ b/docs/RefsApi.md @@ -0,0 +1,191 @@ +# \RefsApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**RepositoriesUsernameRepoSlugRefsBranchesGet**](RefsApi.md#RepositoriesUsernameRepoSlugRefsBranchesGet) | **Get** /repositories/{username}/{repo_slug}/refs/branches | +[**RepositoriesUsernameRepoSlugRefsBranchesNameGet**](RefsApi.md#RepositoriesUsernameRepoSlugRefsBranchesNameGet) | **Get** /repositories/{username}/{repo_slug}/refs/branches/{name} | +[**RepositoriesUsernameRepoSlugRefsGet**](RefsApi.md#RepositoriesUsernameRepoSlugRefsGet) | **Get** /repositories/{username}/{repo_slug}/refs | +[**RepositoriesUsernameRepoSlugRefsTagsGet**](RefsApi.md#RepositoriesUsernameRepoSlugRefsTagsGet) | **Get** /repositories/{username}/{repo_slug}/refs/tags | +[**RepositoriesUsernameRepoSlugRefsTagsNameGet**](RefsApi.md#RepositoriesUsernameRepoSlugRefsTagsNameGet) | **Get** /repositories/{username}/{repo_slug}/refs/tags/{name} | +[**RepositoriesUsernameRepoSlugRefsTagsPost**](RefsApi.md#RepositoriesUsernameRepoSlugRefsTagsPost) | **Post** /repositories/{username}/{repo_slug}/refs/tags | + + +# **RepositoriesUsernameRepoSlugRefsBranchesGet** +> ModelError RepositoriesUsernameRepoSlugRefsBranchesGet(ctx, username, repoSlug) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugRefsBranchesNameGet** +> ModelError RepositoriesUsernameRepoSlugRefsBranchesNameGet(ctx, username, name, repoSlug) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **name** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugRefsGet** +> ModelError RepositoriesUsernameRepoSlugRefsGet(ctx, username, repoSlug) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugRefsTagsGet** +> ModelError RepositoriesUsernameRepoSlugRefsTagsGet(ctx, username, repoSlug) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The username for the owner of the repository. This can either be the `username` of the owner or the `UUID` of the owner (surrounded by curly-braces (`{}`)). Owners can be users or teams. | + **repoSlug** | **string**| The repo slug for the repository. This can either be the `repo_slug` of the repository or the `UUID` of the repository (surrounded by curly-braces (`{}`)) | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugRefsTagsNameGet** +> ModelError RepositoriesUsernameRepoSlugRefsTagsNameGet(ctx, username, name, repoSlug) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **name** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugRefsTagsPost** +> Tag RepositoriesUsernameRepoSlugRefsTagsPost(ctx, username, repoSlug, body) + + +Creates a new tag in the specified repository. The payload of the POST should consist of a JSON document that contains the name of the tag and the target hash. ``` { \"name\" : \"new tag name\", \"target\" : { \"hash\" : \"target commit hash\", } } ``` This endpoint does support using short hash prefixes for the commit hash, but it may return a 400 response if the provided prefix is ambiguous. Using a full commit hash is the preferred approach. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The username for the owner of the repository. This can either be the `username` of the owner or the `UUID` of the owner (surrounded by curly-braces (`{}`)). Owners can be users or teams. | + **repoSlug** | **string**| The repo slug for the repository. This can either be the `repo_slug` of the repository or the `UUID` of the repository (surrounded by curly-braces (`{}`)) | + **body** | [**Tag**](Tag.md)| | + +### Return type + +[**Tag**](tag.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/RepositoriesApi.md b/docs/RepositoriesApi.md new file mode 100644 index 0000000..4c5d831 --- /dev/null +++ b/docs/RepositoriesApi.md @@ -0,0 +1,879 @@ +# \RepositoriesApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**RepositoriesGet**](RepositoriesApi.md#RepositoriesGet) | **Get** /repositories | +[**RepositoriesUsernameGet**](RepositoriesApi.md#RepositoriesUsernameGet) | **Get** /repositories/{username} | +[**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet) | **Get** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key} | +[**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut**](RepositoriesApi.md#RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut) | **Put** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key} | +[**RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost**](RepositoriesApi.md#RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost) | **Post** /repositories/{username}/{repo_slug}/commit/{node}/statuses/build | +[**RepositoriesUsernameRepoSlugCommitNodeStatusesGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugCommitNodeStatusesGet) | **Get** /repositories/{username}/{repo_slug}/commit/{node}/statuses | +[**RepositoriesUsernameRepoSlugDelete**](RepositoriesApi.md#RepositoriesUsernameRepoSlugDelete) | **Delete** /repositories/{username}/{repo_slug} | +[**RepositoriesUsernameRepoSlugFilehistoryNodePathGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugFilehistoryNodePathGet) | **Get** /repositories/{username}/{repo_slug}/filehistory/{node}/{path} | +[**RepositoriesUsernameRepoSlugForksGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugForksGet) | **Get** /repositories/{username}/{repo_slug}/forks | +[**RepositoriesUsernameRepoSlugForksPost**](RepositoriesApi.md#RepositoriesUsernameRepoSlugForksPost) | **Post** /repositories/{username}/{repo_slug}/forks | +[**RepositoriesUsernameRepoSlugGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugGet) | **Get** /repositories/{username}/{repo_slug} | +[**RepositoriesUsernameRepoSlugHooksGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugHooksGet) | **Get** /repositories/{username}/{repo_slug}/hooks | +[**RepositoriesUsernameRepoSlugHooksPost**](RepositoriesApi.md#RepositoriesUsernameRepoSlugHooksPost) | **Post** /repositories/{username}/{repo_slug}/hooks | +[**RepositoriesUsernameRepoSlugHooksUidDelete**](RepositoriesApi.md#RepositoriesUsernameRepoSlugHooksUidDelete) | **Delete** /repositories/{username}/{repo_slug}/hooks/{uid} | +[**RepositoriesUsernameRepoSlugHooksUidGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugHooksUidGet) | **Get** /repositories/{username}/{repo_slug}/hooks/{uid} | +[**RepositoriesUsernameRepoSlugHooksUidPut**](RepositoriesApi.md#RepositoriesUsernameRepoSlugHooksUidPut) | **Put** /repositories/{username}/{repo_slug}/hooks/{uid} | +[**RepositoriesUsernameRepoSlugPost**](RepositoriesApi.md#RepositoriesUsernameRepoSlugPost) | **Post** /repositories/{username}/{repo_slug} | +[**RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet) | **Get** /repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/statuses | +[**RepositoriesUsernameRepoSlugPut**](RepositoriesApi.md#RepositoriesUsernameRepoSlugPut) | **Put** /repositories/{username}/{repo_slug} | +[**RepositoriesUsernameRepoSlugSrcGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugSrcGet) | **Get** /repositories/{username}/{repo_slug}/src | +[**RepositoriesUsernameRepoSlugSrcNodePathGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugSrcNodePathGet) | **Get** /repositories/{username}/{repo_slug}/src/{node}/{path} | +[**RepositoriesUsernameRepoSlugSrcPost**](RepositoriesApi.md#RepositoriesUsernameRepoSlugSrcPost) | **Post** /repositories/{username}/{repo_slug}/src | +[**RepositoriesUsernameRepoSlugWatchersGet**](RepositoriesApi.md#RepositoriesUsernameRepoSlugWatchersGet) | **Get** /repositories/{username}/{repo_slug}/watchers | +[**UserPermissionsRepositoriesGet**](RepositoriesApi.md#UserPermissionsRepositoriesGet) | **Get** /user/permissions/repositories | + + +# **RepositoriesGet** +> PaginatedRepositories RepositoriesGet(ctx, optional) + + +Returns a paginated list of all public repositories. This endpoint also supports filtering and sorting of the results. See [filtering and sorting](../meta/filtering) for more details. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **after** | **string**| Filter the results to include only repositories create on or after this [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. Example: `YYYY-MM-DDTHH:mm:ss.sssZ` | + +### Return type + +[**PaginatedRepositories**](paginated_repositories.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameGet** +> PaginatedRepositories RepositoriesUsernameGet(ctx, username, optional) + + +Returns a paginated list of all repositories owned by the specified account or UUID. The result can be narrowed down based on the authenticated user's role. E.g. with `?role=contributor`, only those repositories that the authenticated user has write access to are returned (this includes any repo the user is an admin on, as that implies write access). This endpoint also supports filtering and sorting of the results. See [filtering and sorting](../../meta/filtering) for more details. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **role** | **string**| Filters the result based on the authenticated user's role on each repository. * **member**: returns repositories to which the user has explicit read access * **contributor**: returns repositories to which the user has explicit write access * **admin**: returns repositories to which the user has explicit administrator access * **owner**: returns all repositories owned by the current user | + +### Return type + +[**PaginatedRepositories**](paginated_repositories.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet** +> Commitstatus RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet(ctx, username, repoSlug, node, key) + + +Returns the specified build status for a commit. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + **key** | **string**| The build status' unique key | + +### Return type + +[**Commitstatus**](commitstatus.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut** +> Commitstatus RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut(ctx, username, repoSlug, node, key, optional) + + +Used to update the current status of a build status object on the specific commit. This operation can also be used to change other properties of the build status: * `state` * `name` * `description` * `url` * `refname` The `key` cannot be changed. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + **key** | **string**| The commit status' unique key | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + **key** | **string**| The commit status' unique key | + **body** | [**Commitstatus**](Commitstatus.md)| The updated build status object | + +### Return type + +[**Commitstatus**](commitstatus.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost** +> Commitstatus RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost(ctx, username, repoSlug, node, optional) + + +Creates a new build status against the specified commit. If the specified key already exists, the existing status object will be overwritten. When creating a new commit status, you can use a URI template for the URL. Templates are URLs that contain variable names that Bitbucket will evaluate at runtime whenever the URL is displayed anywhere similar to parameter substitution in [Bitbucket Connect](https://developer.atlassian.com/bitbucket/concepts/context-parameters.html). For example, one could use `https://foo.com/builds/{repository.full_name}` which Bitbucket will turn into `https://foo.com/builds/foo/bar` at render time. The context variables available are `repository` and `commit`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + **body** | [**Commitstatus**](Commitstatus.md)| The new commit status object. | + +### Return type + +[**Commitstatus**](commitstatus.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugCommitNodeStatusesGet** +> PaginatedCommitstatuses RepositoriesUsernameRepoSlugCommitNodeStatusesGet(ctx, username, repoSlug, node) + + +Returns all statuses (e.g. build results) for a specific commit. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **node** | **string**| The commit's SHA1 | + +### Return type + +[**PaginatedCommitstatuses**](paginated_commitstatuses.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugDelete** +> RepositoriesUsernameRepoSlugDelete(ctx, username, repoSlug, optional) + + +Deletes the repository. This is an irreversible operation. This does not affect its forks. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **redirectTo** | **string**| If a repository has been moved to a new location, use this parameter to show users a friendly message in the Bitbucket UI that the repository has moved to a new location. However, a GET to this endpoint will still return a 404. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugFilehistoryNodePathGet** +> PaginatedFiles RepositoriesUsernameRepoSlugFilehistoryNodePathGet(ctx, username, node, path, repoSlug, optional) + + +Returns a paginated list of commits that modified the specified file. Commits are returned in reverse chronological order. This is roughly equivalent to the following commands: $ git log --follow --date-order $ hg log --follow By default, Bitbucket will follow renames and the path name in the returned entries reflects that. This can be turned off using the `?renames=false` query parameter. Results are returned in descending chronological order by default, and like most endpoints you can [filter and sort](../../../../../../meta/filtering) the response to only provide exactly the data you want. For example, if you wanted to find commits made before 2011-05-18 against a file named `README.rst`, but you only wanted the path and date, your query would look like this: ``` $ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\\ '?fields=values.next,values.path,values.commit.date&q=commit.date<=2011-05-18' { \"values\": [ { \"commit\": { \"date\": \"2011-05-17T07:32:09+00:00\" }, \"path\": \"README.rst\" }, { \"commit\": { \"date\": \"2011-05-16T06:33:28+00:00\" }, \"path\": \"README.txt\" }, { \"commit\": { \"date\": \"2011-05-16T06:15:39+00:00\" }, \"path\": \"README.txt\" } ] } ``` In the response you can see that the file was renamed to `README.rst` by the commit made on 2011-05-16, and was previously named `README.txt`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **node** | **string**| | + **path** | **string**| | + **repoSlug** | **string**| | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **node** | **string**| | + **path** | **string**| | + **repoSlug** | **string**| | + **renames** | **string**| When `true`, Bitbucket will follow the history of the file across renames (this is the default behavior). This can be turned off by specifying `false`. | + **q** | **string**| Query string to narrow down the response as per [filtering and sorting](../../../../../../meta/filtering). | + **sort** | **string**| Name of a response property sort the result by as per [filtering and sorting](../../../../../../meta/filtering#query-sort). | + +### Return type + +[**PaginatedFiles**](paginated_files.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugForksGet** +> PaginatedRepositories RepositoriesUsernameRepoSlugForksGet(ctx, username, repoSlug) + + +Returns a paginated list of all the forks of the specified repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**PaginatedRepositories**](paginated_repositories.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugForksPost** +> Repository RepositoriesUsernameRepoSlugForksPost(ctx, username, repoSlug, optional) + + +Creates a new fork of the specified repository. By default, forks are created under the authenticated user's account with the same name and slug of the original repository. ``` $ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/forks { \"scm\": \"git\", \"full_name\": \"jdoe/dogslow\", \"parent\": { \"full_name\": \"evzijst/dogslow\", ... }, ... } ``` If you already have a repo with that name, then a 400 is returned and you'll need to specify a custom name for the new fork: ``` $ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/forks \\ -H 'Content-Type: application/json' -d '{ \"name\": \"dogslow_fork\" }' ``` When you specify a value for `name`, it will also affect the `slug`. The `slug` is reflected in the repository URL of the new fork. It is derived from `name` by substituting non-ASCII characters, removes whitespace, and changes characters to lower case. For example, `My repo` would turn into `my_repo`. ## Forking a repository into a team account To create a fork into a team account, specify the new owner's account explicitly as part of the request body. This prevents forked repositories from being owned by the authenticated user submitting the request: ``` $ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/atlassian/bbql/forks \\ -H 'Content-Type: application/json' -d '{ \"name\": \"bbql_fork\", \"owner\": { \"username\": \"atlassian\" } }' ``` To fork a repository into the same team, also specify a new `name`. You need contributor access to create new forks within a team account. ## Change the properties of a new fork By default the fork inherits most of its properties from the parent. However, since the optional POST body document follows the normal `repository` JSON schema and you can override the new fork's properties. Properties that can be overridden include: * description * fork_policy * language * mainbranch * is_private (note that a private repo's fork_policy might prohibit the creation of public forks, in which `is_private=False` would fail) * has_issues (to initialize or disable the new repo's issue tracker -- note that the actual contents of the parent repository's issue tracker are not copied during forking) * has_wiki (to initialize or disable the new repo's wiki -- note that the actual contents of the parent repository's wiki are not copied during forking) * project (only teams have projects and when forking into a private project, the fork's `is_private` must be `true`) Properties that cannot be modified include: * scm * parent * full_name + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **body** | [**Repository**](Repository.md)| A repository object. This can be left blank. | + +### Return type + +[**Repository**](repository.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugGet** +> Repository RepositoriesUsernameRepoSlugGet(ctx, username, repoSlug) + + +Returns the object describing this repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + +### Return type + +[**Repository**](repository.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugHooksGet** +> PaginatedWebhookSubscriptions RepositoriesUsernameRepoSlugHooksGet(ctx, username, repoSlug) + + +Returns a paginated list of webhooks installed on this repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**PaginatedWebhookSubscriptions**](paginated_webhook_subscriptions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugHooksPost** +> WebhookSubscription RepositoriesUsernameRepoSlugHooksPost(ctx, username, repoSlug) + + +Creates a new webhook on the specified repository. Example: ``` $ curl -X POST -u credentials -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/repositories/username/slug/hooks -d ' { \"description\": \"Webhook Description\", \"url\": \"https://example.com/\", \"active\": true, \"events\": [ \"repo:push\", \"issue:created\", \"issue:updated\" ] }' ``` Note that this call requires the webhook scope, as well as any scope that applies to the events that the webhook subscribes to. In the example above that means: `webhook`, `repository` and `issue`. Also note that the `url` must properly resolve and cannot be an internal, non-routed address. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugHooksUidDelete** +> RepositoriesUsernameRepoSlugHooksUidDelete(ctx, username, repoSlug, uid) + + +Deletes the specified webhook subscription from the given repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugHooksUidGet** +> WebhookSubscription RepositoriesUsernameRepoSlugHooksUidGet(ctx, username, repoSlug, uid) + + +Returns the webhook with the specified id installed on the specified repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **uid** | **string**| The installed webhook's id. | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugHooksUidPut** +> WebhookSubscription RepositoriesUsernameRepoSlugHooksUidPut(ctx, username, repoSlug, uid) + + +Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPost** +> Repository RepositoriesUsernameRepoSlugPost(ctx, username, repoSlug, optional) + + +Creates a new repository. Note: In order to set the project for the newly created repository, pass in either the project key or the project UUID as part of the request body as shown in the examples below: ``` $ curl -X POST -H \"Content-Type: application/json\" -d '{ \"scm\": \"git\", \"project\": { \"key\": \"MARS\" } }' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding ``` or ``` $ curl -X POST -H \"Content-Type: application/json\" -d '{ \"scm\": \"git\", \"project\": { \"key\": \"{ba516952-992a-4c2d-acbd-17d502922f96}\" } }' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding ``` The project must only be assigned for repositories belonging to a team. If the repository owner is a team and the project is not provided, the repository is automatically assigned to the oldest project in the team. Note: In the examples above, the username `teamsinspace`, and/or the repository name `hablanding` can be replaced by UUIDs. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **body** | [**Repository**](Repository.md)| The repository that is to be created. Note that most object elements are optional. Elements \"owner\" and \"full_name\" are ignored as the URL implies them. | + +### Return type + +[**Repository**](repository.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet** +> PaginatedCommitstatuses RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet(ctx, username, repoSlug, pullRequestId) + + +Returns all statuses (e.g. build results) for the given pull request. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **pullRequestId** | **int32**| The pull request's id | + +### Return type + +[**PaginatedCommitstatuses**](paginated_commitstatuses.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugPut** +> Repository RepositoriesUsernameRepoSlugPut(ctx, username, repoSlug, optional) + + +Since this endpoint can be used to both update and to create a repository, the request body depends on the intent. ### Creation See the POST documentation for the repository endpoint for an example of the request body. ### Update Note: Changing the `name` of the repository will cause the location to be changed. This is because the URL of the repo is derived from the name (a process called slugification). In such a scenario, it is possible for the request to fail if the newly created slug conflicts with an existing repository's slug. But if there is no conflict, the new location will be returned in the `Location` header of the response. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. | + **repoSlug** | **string**| This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. | + **body** | [**Repository**](Repository.md)| The repository that is to be updated. Note that the elements \"owner\" and \"full_name\" are ignored since the URL implies them. | + +### Return type + +[**Repository**](repository.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugSrcGet** +> PaginatedTreeentries RepositoriesUsernameRepoSlugSrcGet(ctx, username, repoSlug, optional) + + +This endpoint redirects the client to the directory listing of the root directory on the main branch. This is equivalent to directly hitting [/2.0/repositories/{username}/{repo_slug}/src/{node}/{path}](src/%7Bnode%7D/%7Bpath%7D) without having to know the name or SHA1 of the repo's main branch. To create new commits, [POST to this endpoint](#post) + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **repoSlug** | **string**| | + **format** | **string**| Instead of returning the file's contents, return the (json) meta data for it. | + +### Return type + +[**PaginatedTreeentries**](paginated_treeentries.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugSrcNodePathGet** +> PaginatedTreeentries RepositoriesUsernameRepoSlugSrcNodePathGet(ctx, username, node, path, repoSlug, optional) + + +This endpoints is used to retrieve the contents of a single file, or the contents of a directory at a specified revision. ## Raw file contents When `path` points to a file, this endpoint returns the raw contents. The response's Content-Type is derived from the filename extension (not from the contents). The file contents are not processed and no character encoding/recoding is performed and as a result no character encoding is included as part of the Content-Type. The `Content-Disposition` header will be \"attachment\" to prevent browsers from running executable files. If the file is managed by LFS, then a 301 redirect pointing to Atlassian's media services platform is returned. The response includes an ETag that is based on the contents of the file and its attributes. This means that an empty `__init__.py` always returns the same ETag, regardless on the directory it lives in, or the commit it is on. ## File meta data When the request for a file path includes the query parameter `?format=meta`, instead of returning the file's raw contents, Bitbucket instead returns the JSON object describing the file's properties: ```javascript $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests/__init__.py?format=meta { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\" } }, \"path\": \"tests/__init__.py\", \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } }, \"attributes\": [], \"type\": \"commit_file\", \"size\": 0 } ``` File objects contain an `attributes` element that contains a list of possible modifiers. Currently defined values are: * `link` -- indicates that the entry is a symbolic link. The contents of the file represent the path the link points to. * `executable` -- indicates that the file has the executable bit set. * `subrepository` -- indicates that the entry points to a submodule or subrepo. The contents of the file is the SHA1 of the repository pointed to. * `binary` -- indicates whether Bitbucket thinks the file is binary. This endpoint can provide an alternative to how a HEAD request can be used to check for the existence of a file, or a file's size without incurring the overhead of receiving its full contents. ## Directory listings When `path` points to a directory instead of a file, the response is a paginated list of directory and file objects in the same order as the underlying SCM system would return them. For example: ```javascript $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests { \"pagelen\": 10, \"values\": [ { \"path\": \"tests/test_project\", \"type\": \"commit_directory\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\" } }, \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } } }, { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\" } }, \"path\": \"tests/__init__.py\", \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } }, \"attributes\": [], \"type\": \"commit_file\", \"size\": 0 } ], \"page\": 1, \"size\": 2 } ``` When listing the contents of the repo's root directory, the use of a trailing slash at the end of the URL is required. The response is not recursive, meaning that only the direct contents of a path are returned. The response does not recurse down into subdirectories. In order to \"walk\" the entire directory tree, the client needs to parse each response and follow the `self` links of each `commit_directory` object. Each returned object is either a `commit_file`, or a `commit_directory`, both of which contain a `path` element. This path is the absolute path from the root of the repository. Each object also contains a `commit` object which embeds the commit the file is on. Note that this is merely the commit that was used in the URL. It is *not* the commit that last modified the file. Directory objects have 2 representations. Their `self` link returns the paginated contents of the directory. The `meta` link on the other hand returns the actual `directory` object itself, e.g.: ```javascript { \"path\": \"tests/test_project\", \"type\": \"commit_directory\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\" } }, \"commit\": { ... } } ``` ## Querying, filtering and sorting Like most API endpoints, this API supports the Bitbucket querying/filtering syntax and so you could filter a directory listing to only include entries that match certain criteria. For instance, to list all binary files over 1kb use the expression: `size > 1024 and attributes = \"binary\"` which after urlencoding yields the query string: `?q=size%3E1024+and+attributes%3D%22binary%22` To change the ordering of the response, use the `?sort` parameter: `.../src/eefd5ef/?sort=-size` See [filtering and sorting](../../../../../../meta/filtering) for more details. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **node** | **string**| | + **path** | **string**| | + **repoSlug** | **string**| | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **node** | **string**| | + **path** | **string**| | + **repoSlug** | **string**| | + **format** | **string**| If 'meta' is provided, returns the (json) meta data for the contents of the file. If 'rendered' is provided, returns the contents of a non-binary file in HTML-formatted rendered markup. Since Git and Mercurial do not generally track what text encoding scheme is used, this endpoint attempts to detect the most appropriate character encoding. While usually correct, determining the character encoding can be ambiguous which in exceptional cases can lead to misinterpretation of the characters. As such, the raw element in the response object should not be treated as equivalent to the file's actual contents. | + **q** | **string**| Optional filter expression as per [filtering and sorting](../../../../../../meta/filtering). | + **sort** | **string**| Optional sorting parameter as per [filtering and sorting](../../../../../../meta/filtering#query-sort). | + +### Return type + +[**PaginatedTreeentries**](paginated_treeentries.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugSrcPost** +> RepositoriesUsernameRepoSlugSrcPost(ctx, username, repoSlug, optional) + + +This endpoint is used to create new commits in the repository by uploading files. To add a new file to a repository: ``` $ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \\ -F /repo/path/to/image.png=@image.png ``` This will create a new commit on top of the main branch, inheriting the contents of the main branch, but adding (or overwriting) the `image.png` file to the repository in the `/repo/path/to` directory. This endpoint accepts `multipart/form-data` (as in the example above), as well as `application/x-www-form-urlencoded`. ## multipart/form-data A `multipart/form-data` post contains a series of \"form fields\" that identify both the individual files that are being uploaded, as well as additional, optional meta data. Files are uploaded in file form fields (those that have a `Content-Disposition` parameter) whose field names point to the remote path in the repository where the file should be stored. Path field names are always interpreted to be absolute from the root of the repository, regardless whether the client uses a leading slash (as the above `curl` example did). File contents are treated as bytes and are not decoded as text. The commit message, as well as other non-file meta data for the request, is sent along as normal form field elements. Meta data fields share the same namespace as the file objects. For `multipart/form-data` bodies that should not lead to any ambiguity, as the `Content-Disposition` header will contain the `filename` parameter to distinguish between a file named \"message\" and the commit message field. ## application/x-www-form-urlencoded It is also possible to upload new files using a simple `application/x-www-form-urlencoded` POST. This can be convenient when uploading pure text files: ``` $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/ \\ --data-urlencode \"/path/to/me.txt=Lorem ipsum.\" \\ --data-urlencode \"message=Initial commit\" \\ --data-urlencode \"author=Erik van Zijst \" ``` There could be a field name clash if a client were to upload a file named \"message\", as this filename clashes with the meta data property for the commit message. To avoid this and to upload files whose names clash with the meta data properties, use a leading slash for the files, e.g. `curl --data-urlencode \"/message=file contents\"`. When an explicit slash is omitted for a file whose path matches that of a meta data parameter, then it is interpreted as meta data, not as a file. ## Executables and links While this API aims to facilitate the most common use cases, it is possible to perform some more advanced operations like creating a new symlink in the repository, or creating an executable file. Files can be supplied with a `x-attributes` value in the `Content-Disposition` header. For example, to upload an executable file, as well as create a symlink from `README.txt` to `README`: ``` --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"bin/shutdown.sh\" Content-Disposition: attachment; filename=\"shutdown.sh\"; x-attributes:\"executable\" #!/bin/sh halt --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"/README.txt\" Content-Disposition: attachment; filename=\"README.txt\"; x-attributes:\"link\" README --===============1438169132528273974==-- ``` Links are files that contain the target path and have `x-attributes:\"link\"` set. When overwriting links with files, or vice versa, the newly uploaded file determines both the new contents, as well as the attributes. That means uploading a file without specifying `x-attributes=\"link\"` will create a regular file, even if the parent commit hosted a symlink at the same path. The same applies to executables. When modifying an existing executable file, the form-data file element must include `x-attributes=\"executable\"` in order to preserve the executable status of the file. Note that this API does not support the creation or manipulation of subrepos / submodules. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **repoSlug** | **string**| | + **message** | **string**| The commit message. When omitted, Bitbucket uses a canned string. | + **author** | **string**| The raw string to be used as the new commit's author. This string follows the format `Erik van Zijst <evzijst@atlassian.com>`. When omitted, Bitbucket uses the authenticated user's full/display name and primary email address. Commits cannot be created anonymously. | + **parents** | **string**| A comma-separated list of SHA1s of the commits that should be the parents of the newly created commit. When omitted, the new commit will inherit from and become a child of the main branch's tip/HEAD commit. When more than one SHA1 is provided, the first SHA1 identifies the commit from which the content will be inherited. When more than 2 parents are provided on a Mercurial repo, a 400 is returned as Mercurial does not support \"octopus merges\". | + **files** | **string**| Optional field that declares the files that the request is manipulating. When adding a new file to a repo, or when overwriting an existing file, the client can just upload the full contents of the file in a normal form field and the use of this `files` meta data field is redundant. However, when the `files` field contains a file path that does not have a corresponding, identically-named form field, then Bitbucket interprets that as the client wanting to replace the named file with the null set and the file is deleted instead. Paths in the repo that are referenced in neither files nor an individual file field, remain unchanged and carry over from the parent to the new commit. This API does not support renaming as an explicit feature. To rename a file, simply delete it and recreate it under the new name in the same commit. | + **files2** | **string**| The name of the branch that the new commit should be created on. When omitted, the commit will be created on top of the main branch and will become the main branch's new HEAD/tip. When a branch name is provided that already exists in the repo, then the commit will be created on top of that branch. In this case, if a parent SHA1 was also provided, then it is asserted that the parent is the branch's tip/HEAD at the time the request is made. When this is not the case, a 409 is returned. This API cannot be used to create new anonymous heads in Mercurial repos. When a new branch name is specified (that does not already exist in the repo), and no parent SHA1s are provided, then the new commit will inherit from the current main branch's tip/HEAD commit, but not advance the main branch. The new commit will be the new branch. When the request also specifies a parent SHA1, then the new commit and branch are created directly on top of the parent commit, regardless of the state of the main branch. When a branch name is not specified, but a parent SHA1 is provided, then Bitbucket asserts that it represents the main branch's current HEAD/tip, or a 409 is returned. When a branch name is not specified and the repo is empty, the new commit will become the repo's root commit and will be on the main branch. When a branch name is specified and the repo is empty, the new commit will become the repo's root commit and also define the repo's main branch going forward. This API cannot be used to create additional root commits in non-empty repos. The branch field cannot be repeated. As a side effect, this API can be used to create a new branch without modifying any files, by specifying a new branch name in this field, together with parents, but omitting the files fields, while not sending any files. This will create a new commit and branch with the same contents as the first parent. The diff of this commit against its first parent will be empty. | + **branch** | **string**| The name of the branch that the new commit should be created on. When omitted, the commit will be created on top of the main branch and will become the main branch's new head. When a branch name is provided that already exists in the repo, then the commit will be created on top of that branch. In this case, *if* a parent SHA1 was also provided, then it is asserted that the parent is the branch's tip/HEAD at the time the request is made. When this is not the case, a 409 is returned. This API cannot be used to create new anonymous heads in Mercurial repositories. When a new branch name is specified (that does not already exist in the repo), and no parent SHA1s are provided, then the new commit will inherit from the current main branch's tip/HEAD commit, but not advance the main branch. The new commit will be the new branch. When the request *also* specifies a parent SHA1, then the new commit and branch are created directly on top of the parent commit, regardless of the state of the main branch. When a branch name is not specified, but a parent SHA1 is provided, then Bitbucket asserts that it represents the main branch's current HEAD/tip, or a 409 is returned. When a branch name is not specified and the repo is empty, the new commit will become the repo's root commit and will be on the main branch. When a branch name is specified and the repo is empty, the new commit will become the repo's root commit and also define the repo's main branch going forward. This API cannot be used to create additional root commits in non-empty repos. The branch field cannot be repeated. As a side effect, this API can be used to create a new branch without modifying any files, by specifying a new branch name in this field, together with `parents`, but omitting the `files` fields, while not sending any files. This will create a new commit and branch with the same contents as the first parent. The diff of this commit against its first parent will be empty. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugWatchersGet** +> ModelError RepositoriesUsernameRepoSlugWatchersGet(ctx, username, repoSlug) + + +Returns a paginated list of all the watchers on the specified repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UserPermissionsRepositoriesGet** +> PaginatedRepositoryPermissions UserPermissionsRepositoriesGet(ctx, optional) + + +Returns an object for each repository the caller has explicit access to and their effective permission — the highest level of permission the caller has. This does not return public repositories that the user was not granted any specific permission in, and does not distinguish between direct and indirect privileges. Permissions can be: * `admin` * `write` * `read` Example: ``` $ curl https://api.bitbucket.org/2.0/user/permissions/repositories { \"pagelen\": 10, \"values\": [ { \"type\": \"repository_permission\", \"user\": { \"type\": \"user\", \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\" }, \"repository\": { \"type\": \"repository\", \"name\": \"geordi\", \"full_name\": \"bitbucket/geordi\", \"uuid\": \"{85d08b4e-571d-44e9-a507-fa476535aa98}\" }, \"permission\": \"admin\" } ], \"page\": 1, \"size\": 1 } ``` Results may be further [filtered or sorted](../../../meta/filtering) by repository or permission by adding the following query string parameters: * `q=repository.name=\"geordi\"` or `q=permission>\"read\"` * `sort=repository.name` Note that the query parameter values need to be URL escaped so that `=` would become `%3D`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **q** | **string**| Query string to narrow down the response as per [filtering and sorting](../../../meta/filtering). | + **sort** | **string**| Name of a response property sort the result by as per [filtering and sorting](../../../meta/filtering#query-sort). | + +### Return type + +[**PaginatedRepositoryPermissions**](paginated_repository_permissions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Repository.md b/docs/Repository.md new file mode 100644 index 0000000..32be99b --- /dev/null +++ b/docs/Repository.md @@ -0,0 +1,27 @@ +# Repository + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***RepositoryLinks**](repository_links.md) | | [optional] [default to null] +**Uuid** | **string** | The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user. | [optional] [default to null] +**FullName** | **string** | The concatenation of the repository owner's username and the slugified name, e.g. \"evzijst/interruptingcow\". This is the same string used in Bitbucket URLs. | [optional] [default to null] +**IsPrivate** | **bool** | | [optional] [default to null] +**Parent** | [***Repository**](repository.md) | | [optional] [default to null] +**Scm** | **string** | | [optional] [default to null] +**Owner** | [***Account**](account.md) | | [optional] [default to null] +**Name** | **string** | | [optional] [default to null] +**Description** | **string** | | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**UpdatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Size** | **int32** | | [optional] [default to null] +**Language** | **string** | | [optional] [default to null] +**HasIssues** | **bool** | | [optional] [default to null] +**HasWiki** | **bool** | | [optional] [default to null] +**ForkPolicy** | **string** | Controls the rules for forking this repository. * **allow_forks**: unrestricted forking * **no_public_forks**: restrict forking to private forks (forks cannot be made public later) * **no_forks**: deny all forking | [optional] [default to null] +**Project** | [***Project**](project.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RepositoryLinks.md b/docs/RepositoryLinks.md new file mode 100644 index 0000000..374dd50 --- /dev/null +++ b/docs/RepositoryLinks.md @@ -0,0 +1,19 @@ +# RepositoryLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Html** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Avatar** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Pullrequests** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Commits** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Forks** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Watchers** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Downloads** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Clone** | [**[]MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Hooks** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RepositoryPermission.md b/docs/RepositoryPermission.md new file mode 100644 index 0000000..0a40a1a --- /dev/null +++ b/docs/RepositoryPermission.md @@ -0,0 +1,13 @@ +# RepositoryPermission + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Permission** | **string** | | [optional] [default to null] +**User** | [***User**](user.md) | | [optional] [default to null] +**Repository** | [***Repository**](repository.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SearchResult.md b/docs/SearchResult.md new file mode 100644 index 0000000..02a450b --- /dev/null +++ b/docs/SearchResult.md @@ -0,0 +1,11 @@ +# SearchResult + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Next** | **string** | | [optional] [default to null] +**Previous** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Snippet.md b/docs/Snippet.md new file mode 100644 index 0000000..ff60dfa --- /dev/null +++ b/docs/Snippet.md @@ -0,0 +1,18 @@ +# Snippet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Id** | **int32** | | [optional] [default to null] +**Title** | **string** | | [optional] [default to null] +**Scm** | **string** | The DVCS used to store the snippet. | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**UpdatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Owner** | [***Account**](account.md) | | [optional] [default to null] +**Creator** | [***Account**](account.md) | | [optional] [default to null] +**IsPrivate** | **bool** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SnippetComment.md b/docs/SnippetComment.md new file mode 100644 index 0000000..878d696 --- /dev/null +++ b/docs/SnippetComment.md @@ -0,0 +1,12 @@ +# SnippetComment + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***GroupLinks**](group_links.md) | | [optional] [default to null] +**Snippet** | [***Snippet**](snippet.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SnippetCommit.md b/docs/SnippetCommit.md new file mode 100644 index 0000000..7cb5b40 --- /dev/null +++ b/docs/SnippetCommit.md @@ -0,0 +1,18 @@ +# SnippetCommit + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Hash** | **string** | | [optional] [default to null] +**Date** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Author** | [***Author**](author.md) | | [optional] [default to null] +**Message** | **string** | | [optional] [default to null] +**Summary** | [***PullrequestSummary**](pullrequest_summary.md) | | [optional] [default to null] +**Parents** | [**[]BaseCommit**](base_commit.md) | | [optional] [default to null] +**Links** | [***SnippetCommitLinks**](snippet_commit_links.md) | | [optional] [default to null] +**Snippet** | [***Snippet**](snippet.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SnippetCommitLinks.md b/docs/SnippetCommitLinks.md new file mode 100644 index 0000000..df57b7d --- /dev/null +++ b/docs/SnippetCommitLinks.md @@ -0,0 +1,12 @@ +# SnippetCommitLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Html** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Diff** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SnippetsApi.md b/docs/SnippetsApi.md new file mode 100644 index 0000000..2d56479 --- /dev/null +++ b/docs/SnippetsApi.md @@ -0,0 +1,764 @@ +# \SnippetsApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**SnippetsGet**](SnippetsApi.md#SnippetsGet) | **Get** /snippets | +[**SnippetsPost**](SnippetsApi.md#SnippetsPost) | **Post** /snippets | +[**SnippetsUsernameEncodedIdCommentsCommentIdDelete**](SnippetsApi.md#SnippetsUsernameEncodedIdCommentsCommentIdDelete) | **Delete** /snippets/{username}/{encoded_id}/comments/{comment_id} | +[**SnippetsUsernameEncodedIdCommentsCommentIdGet**](SnippetsApi.md#SnippetsUsernameEncodedIdCommentsCommentIdGet) | **Get** /snippets/{username}/{encoded_id}/comments/{comment_id} | +[**SnippetsUsernameEncodedIdCommentsCommentIdPut**](SnippetsApi.md#SnippetsUsernameEncodedIdCommentsCommentIdPut) | **Put** /snippets/{username}/{encoded_id}/comments/{comment_id} | +[**SnippetsUsernameEncodedIdCommentsGet**](SnippetsApi.md#SnippetsUsernameEncodedIdCommentsGet) | **Get** /snippets/{username}/{encoded_id}/comments | +[**SnippetsUsernameEncodedIdCommentsPost**](SnippetsApi.md#SnippetsUsernameEncodedIdCommentsPost) | **Post** /snippets/{username}/{encoded_id}/comments | +[**SnippetsUsernameEncodedIdCommitsGet**](SnippetsApi.md#SnippetsUsernameEncodedIdCommitsGet) | **Get** /snippets/{username}/{encoded_id}/commits | +[**SnippetsUsernameEncodedIdCommitsRevisionGet**](SnippetsApi.md#SnippetsUsernameEncodedIdCommitsRevisionGet) | **Get** /snippets/{username}/{encoded_id}/commits/{revision} | +[**SnippetsUsernameEncodedIdDelete**](SnippetsApi.md#SnippetsUsernameEncodedIdDelete) | **Delete** /snippets/{username}/{encoded_id} | +[**SnippetsUsernameEncodedIdGet**](SnippetsApi.md#SnippetsUsernameEncodedIdGet) | **Get** /snippets/{username}/{encoded_id} | +[**SnippetsUsernameEncodedIdNodeIdDelete**](SnippetsApi.md#SnippetsUsernameEncodedIdNodeIdDelete) | **Delete** /snippets/{username}/{encoded_id}/{node_id} | +[**SnippetsUsernameEncodedIdNodeIdFilesPathGet**](SnippetsApi.md#SnippetsUsernameEncodedIdNodeIdFilesPathGet) | **Get** /snippets/{username}/{encoded_id}/{node_id}/files/{path} | +[**SnippetsUsernameEncodedIdNodeIdGet**](SnippetsApi.md#SnippetsUsernameEncodedIdNodeIdGet) | **Get** /snippets/{username}/{encoded_id}/{node_id} | +[**SnippetsUsernameEncodedIdNodeIdPut**](SnippetsApi.md#SnippetsUsernameEncodedIdNodeIdPut) | **Put** /snippets/{username}/{encoded_id}/{node_id} | +[**SnippetsUsernameEncodedIdPut**](SnippetsApi.md#SnippetsUsernameEncodedIdPut) | **Put** /snippets/{username}/{encoded_id} | +[**SnippetsUsernameEncodedIdRevisionDiffGet**](SnippetsApi.md#SnippetsUsernameEncodedIdRevisionDiffGet) | **Get** /snippets/{username}/{encoded_id}/{revision}/diff | +[**SnippetsUsernameEncodedIdRevisionPatchGet**](SnippetsApi.md#SnippetsUsernameEncodedIdRevisionPatchGet) | **Get** /snippets/{username}/{encoded_id}/{revision}/patch | +[**SnippetsUsernameEncodedIdWatchDelete**](SnippetsApi.md#SnippetsUsernameEncodedIdWatchDelete) | **Delete** /snippets/{username}/{encoded_id}/watch | +[**SnippetsUsernameEncodedIdWatchGet**](SnippetsApi.md#SnippetsUsernameEncodedIdWatchGet) | **Get** /snippets/{username}/{encoded_id}/watch | +[**SnippetsUsernameEncodedIdWatchPut**](SnippetsApi.md#SnippetsUsernameEncodedIdWatchPut) | **Put** /snippets/{username}/{encoded_id}/watch | +[**SnippetsUsernameEncodedIdWatchersGet**](SnippetsApi.md#SnippetsUsernameEncodedIdWatchersGet) | **Get** /snippets/{username}/{encoded_id}/watchers | +[**SnippetsUsernameGet**](SnippetsApi.md#SnippetsUsernameGet) | **Get** /snippets/{username} | +[**SnippetsUsernamePost**](SnippetsApi.md#SnippetsUsernamePost) | **Post** /snippets/{username} | + + +# **SnippetsGet** +> PaginatedSnippets SnippetsGet(ctx, optional) + + +Returns all snippets. Like pull requests, repositories and teams, the full set of snippets is defined by what the current user has access to. This includes all snippets owned by the current user, but also all snippets owned by any of the teams the user is a member of, or snippets by other users that the current user is either watching or has collaborated on (for instance by commenting on it). To limit the set of returned snippets, apply the `?role=[owner|contributor|member]` query parameter where the roles are defined as follows: * `owner`: all snippets owned by the current user * `contributor`: all snippets owned by, or watched by the current user * `member`: owned by the user, their teams, or watched by the current user When no role is specified, all public snippets are returned, as well as all privately owned snippets watched or commented on. The returned response is a normal paginated JSON list. This endpoint only supports `application/json` responses and no `multipart/form-data` or `multipart/related`. As a result, it is not possible to include the file contents. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **role** | **string**| Filter down the result based on the authenticated user's role (`owner`, `contributor`, or `member`). | + +### Return type + +[**PaginatedSnippets**](paginated_snippets.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsPost** +> Snippet SnippetsPost(ctx, body) + + +Creates a new snippet under the authenticated user's account. Snippets can contain multiple files. Both text and binary files are supported. The simplest way to create a new snippet from a local file: $ curl -u username:password -X POST https://api.bitbucket.org/2.0/snippets -F file=@image.png Creating snippets through curl has a few limitations and so let's look at a more complicated scenario. Snippets are created with a multipart POST. Both `multipart/form-data` and `multipart/related` are supported. Both allow the creation of snippets with both meta data (title, etc), as well as multiple text and binary files. The main difference is that `multipart/related` can use rich encoding for the meta data (currently JSON). multipart/related (RFC-2387) ---------------------------- This is the most advanced and efficient way to create a paste. POST /2.0/snippets/evzijst HTTP/1.1 Content-Length: 1188 Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\" MIME-Version: 1.0 --===============1438169132528273974== Content-Type: application/json; charset=\"utf-8\" MIME-Version: 1.0 Content-ID: snippet { \"title\": \"My snippet\", \"is_private\": true, \"scm\": \"hg\", \"files\": { \"foo.txt\": {}, \"image.png\": {} } } --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"foo.txt\" Content-Disposition: attachment; filename=\"foo.txt\" foo --===============1438169132528273974== Content-Type: image/png MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-ID: \"image.png\" Content-Disposition: attachment; filename=\"image.png\" iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5 EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg== --===============1438169132528273974==-- The request contains multiple parts and is structured as follows. The first part is the JSON document that describes the snippet's properties or meta data. It either has to be the first part, or the request's `Content-Type` header must contain the `start` parameter to point to it. The remaining parts are the files of which there can be zero or more. Each file part should contain the `Content-ID` MIME header through which the JSON meta data's `files` element addresses it. The value should be the name of the file. `Content-Disposition` is an optional MIME header. The header's optional `filename` parameter can be used to specify the file name that Bitbucket should use when writing the file to disk. When present, `filename` takes precedence over the value of `Content-ID`. When the JSON body omits the `files` element, the remaining parts are not ignored. Instead, each file is added to the new snippet as if its name was explicitly linked (the use of the `files` elements is mandatory for some operations like deleting or renaming files). multipart/form-data ------------------- The use of JSON for the snippet's meta data is optional. Meta data can also be supplied as regular form fields in a more conventional `multipart/form-data` request: $ curl -X POST -u credentials https://api.bitbucket.org/2.0/snippets -F title=\"My snippet\" -F file=@foo.txt -F file=@image.png POST /2.0/snippets HTTP/1.1 Content-Length: 951 Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"file\"; filename=\"foo.txt\" Content-Type: text/plain foo ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"file\"; filename=\"image.png\" Content-Type: application/octet-stream ?PNG IHDR?1??I..... ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"title\" My snippet ------------------------------63a4b224c59f-- Here the meta data properties are included as flat, top-level form fields. The file attachments use the `file` field name. To attach multiple files, simply repeat the field. The advantage of `multipart/form-data` over `multipart/related` is that it can be easier to build clients. Essentially all properties are optional, `title` and `files` included. Sharing and Visibility ---------------------- Snippets can be either public (visible to anyone on Bitbucket, as well as anonymous users), or private (visible only to the owner, creator and members of the team in case the snippet is owned by a team). This is controlled through the snippet's `is_private` element: * **is_private=false** -- everyone, including anonymous users can view the snippet * **is_private=true** -- only the owner and team members (for team snippets) can view it To create the snippet under a team account, just append the team name to the URL (see `/2.0/snippets/{username}`). + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **body** | [**Snippet**](Snippet.md)| The new snippet object. | + +### Return type + +[**Snippet**](snippet.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdCommentsCommentIdDelete** +> SnippetsUsernameEncodedIdCommentsCommentIdDelete(ctx, username, commentId, encodedId) + + +Deletes a snippet comment. Comments can only be removed by their author. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **commentId** | **string**| | + **encodedId** | **string**| | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdCommentsCommentIdGet** +> SnippetComment SnippetsUsernameEncodedIdCommentsCommentIdGet(ctx, username, commentId, encodedId) + + +Returns the specific snippet comment. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **commentId** | **string**| | + **encodedId** | **string**| | + +### Return type + +[**SnippetComment**](snippet_comment.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdCommentsCommentIdPut** +> SnippetsUsernameEncodedIdCommentsCommentIdPut(ctx, username, commentId, encodedId) + + +Updates a comment. Comments can only be updated by their author. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **commentId** | **string**| | + **encodedId** | **string**| | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdCommentsGet** +> PaginatedSnippetComments SnippetsUsernameEncodedIdCommentsGet(ctx, username, encodedId) + + +Used to retrieve a paginated list of all comments for a specific snippet. This resource works identical to commit and pull request comments. The default sorting is oldest to newest and can be overridden with the `sort` query parameter. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| | + +### Return type + +[**PaginatedSnippetComments**](paginated_snippet_comments.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdCommentsPost** +> Snippet SnippetsUsernameEncodedIdCommentsPost(ctx, username, encodedId, body) + + +Creates a new comment. The only required field in the body is `content.raw`. To create a threaded reply to an existing comment, include `parent.id`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| | + **body** | [**Snippet**](Snippet.md)| The contents of the new comment. | + +### Return type + +[**Snippet**](snippet.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdCommitsGet** +> PaginatedSnippetCommit SnippetsUsernameEncodedIdCommitsGet(ctx, username, encodedId) + + +Returns the changes (commits) made on this snippet. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| | + +### Return type + +[**PaginatedSnippetCommit**](paginated_snippet_commit.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdCommitsRevisionGet** +> SnippetCommit SnippetsUsernameEncodedIdCommitsRevisionGet(ctx, username, encodedId, revision) + + + + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| | + **revision** | **string**| | + +### Return type + +[**SnippetCommit**](snippet_commit.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdDelete** +> SnippetsUsernameEncodedIdDelete(ctx, username, encodedId) + + +Deletes a snippet and returns an empty response. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet's id. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdGet** +> Snippet SnippetsUsernameEncodedIdGet(ctx, username, encodedId) + + +Retrieves a single snippet. Snippets support multiple content types: * application/json * multipart/related * multipart/form-data application/json ---------------- The default content type of the response is `application/json`. Since JSON is always `utf-8`, it cannot reliably contain file contents for files that are not text. Therefore, JSON snippet documents only contain the filename and links to the file contents. This means that in order to retrieve all parts of a snippet, N+1 requests need to be made (where N is the number of files in the snippet). multipart/related ----------------- To retrieve an entire snippet in a single response, use the `Accept: multipart/related` HTTP request header. $ curl -H \"Accept: multipart/related\" https://api.bitbucket.org/2.0/snippets/evzijst/1 Response: HTTP/1.1 200 OK Content-Length: 2214 Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\" MIME-Version: 1.0 --===============1438169132528273974== Content-Type: application/json; charset=\"utf-8\" MIME-Version: 1.0 Content-ID: snippet { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj\" }, \"html\": { \"href\": \"https://bitbucket.org/snippets/evzijst/kypj\" }, \"comments\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/comments\" }, \"watchers\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/watchers\" }, \"commits\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/commits\" } }, \"id\": kypj, \"title\": \"My snippet\", \"created_on\": \"2014-12-29T22:22:04.790331+00:00\", \"updated_on\": \"2014-12-29T22:22:04.790331+00:00\", \"is_private\": false, \"files\": { \"foo.txt\": { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/files/367ab19/foo.txt\" }, \"html\": { \"href\": \"https://bitbucket.org/snippets/evzijst/kypj#file-foo.txt\" } } }, \"image.png\": { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/files/367ab19/image.png\" }, \"html\": { \"href\": \"https://bitbucket.org/snippets/evzijst/kypj#file-image.png\" } } } ], \"owner\": { \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\" }, \"html\": { \"href\": \"https://bitbucket.org/evzijst\" }, \"avatar\": { \"href\": \"https://bitbucket-staging-assetroot.s3.amazonaws.com/c/photos/2013/Jul/31/erik-avatar-725122544-0_avatar.png\" } } }, \"creator\": { \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\" }, \"html\": { \"href\": \"https://bitbucket.org/evzijst\" }, \"avatar\": { \"href\": \"https://bitbucket-staging-assetroot.s3.amazonaws.com/c/photos/2013/Jul/31/erik-avatar-725122544-0_avatar.png\" } } } } --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"foo.txt\" Content-Disposition: attachment; filename=\"foo.txt\" foo --===============1438169132528273974== Content-Type: image/png MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-ID: \"image.png\" Content-Disposition: attachment; filename=\"image.png\" iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5 EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg== --===============1438169132528273974==-- multipart/form-data ------------------- As with creating new snippets, `multipart/form-data` can be used as an alternative to `multipart/related`. However, the inherently flat structure of form-data means that only basic, root-level properties can be returned, while nested elements like `links` are omitted: $ curl -H \"Accept: multipart/form-data\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj Response: HTTP/1.1 200 OK Content-Length: 951 Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"title\" Content-Type: text/plain; charset=\"utf-8\" My snippet ------------------------------63a4b224c59f-- Content-Disposition: attachment; name=\"file\"; filename=\"foo.txt\" Content-Type: text/plain foo ------------------------------63a4b224c59f Content-Disposition: attachment; name=\"file\"; filename=\"image.png\" Content-Transfer-Encoding: base64 Content-Type: application/octet-stream iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5 EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg== ------------------------------5957323a6b76-- + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet's id. | + +### Return type + +[**Snippet**](snippet.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, multipart/related, multipart/form-data + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdNodeIdDelete** +> SnippetsUsernameEncodedIdNodeIdDelete(ctx, username, nodeId, encodedId) + + +Deletes the snippet. Note that this only works for versioned URLs that point to the latest commit of the snippet. Pointing to an older commit results in a 405 status code. To delete a snippet, regardless of whether or not concurrent changes are being made to it, use `DELETE /snippets/{encoded_id}` instead. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **nodeId** | **string**| | + **encodedId** | **string**| The snippet's id. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdNodeIdFilesPathGet** +> SnippetsUsernameEncodedIdNodeIdFilesPathGet(ctx, username, path, nodeId, encodedId) + + +Retrieves the raw contents of a specific file in the snippet. The `Content-Disposition` header will be \"attachment\" to avoid issues with malevolent executable files. The file's mime type is derived from its filename and returned in the `Content-Type` header. Note that for text files, no character encoding is included as part of the content type. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **path** | **string**| | + **nodeId** | **string**| | + **encodedId** | **string**| | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdNodeIdGet** +> Snippet SnippetsUsernameEncodedIdNodeIdGet(ctx, username, encodedId, nodeId) + + +Identical to `GET /snippets/encoded_id`, except that this endpoint can be used to retrieve the contents of the snippet as it was at an older revision, while `/snippets/encoded_id` always returns the snippet's current revision. Note that only the snippet's file contents are versioned, not its meta data properties like the title. Other than that, the two endpoints are identical in behavior. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet's id. | + **nodeId** | **string**| A commit revision (SHA1). | + +### Return type + +[**Snippet**](snippet.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json, multipart/related, multipart/form-data + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdNodeIdPut** +> Snippet SnippetsUsernameEncodedIdNodeIdPut(ctx, username, encodedId, nodeId) + + +Identical to `UPDATE /snippets/encoded_id`, except that this endpoint takes an explicit commit revision. Only the snippet's \"HEAD\"/\"tip\" (most recent) version can be updated and requests on all other, older revisions fail by returning a 405 status. Usage of this endpoint over the unrestricted `/snippets/encoded_id` could be desired if the caller wants to be sure no concurrent modifications have taken place between the moment of the UPDATE request and the original GET. This can be considered a so-called \"Compare And Swap\", or CAS operation. Other than that, the two endpoints are identical in behavior. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet's id. | + **nodeId** | **string**| A commit revision (SHA1). | + +### Return type + +[**Snippet**](snippet.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json, multipart/related, multipart/form-data + - **Accept**: application/json, multipart/related, multipart/form-data + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdPut** +> Snippet SnippetsUsernameEncodedIdPut(ctx, username, encodedId) + + +Used to update a snippet. Use this to add and delete files and to change a snippet's title. To update a snippet, one can either PUT a full snapshot, or only the parts that need to be changed. The contract for PUT on this API is that properties missing from the request remain untouched so that snippets can be efficiently manipulated with differential payloads. To delete a property (e.g. the title, or a file), include its name in the request, but omit its value (use `null`). As in Git, explicit renaming of files is not supported. Instead, to rename a file, delete it and add it again under another name. This can be done atomically in a single request. Rename detection is left to the SCM. PUT supports three different content types for both request and response bodies: * `application/json` * `multipart/related` * `multipart/form-data` The content type used for the request body can be different than that used for the response. Content types are specified using standard HTTP headers. Use the `Content-Type` and `Accept` headers to select the desired request and response format. application/json ---------------- As with creation and retrieval, the content type determines what properties can be manipulated. `application/json` does not support file contents and is therefore limited to a snippet's meta data. To update the title, without changing any of its files: $ curl -X POST -H \"Content-Type: application/json\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj -d '{\"title\": \"Updated title\"}' To delete the title: $ curl -X POST -H \"Content-Type: application/json\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj -d '{\"title\": null}' Not all parts of a snippet can be manipulated. The owner and creator for instance are immutable. multipart/related ----------------- `multipart/related` can be used to manipulate all of a snippet's properties. The body is identical to a POST. properties omitted from the request are left unchanged. Since the `start` part contains JSON, the mechanism for manipulating the snippet's meta data is identical to `application/json` requests. To update one of a snippet's file contents, while also changing its title: PUT /2.0/snippets/evzijst/kypj HTTP/1.1 Content-Length: 288 Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\" MIME-Version: 1.0 --===============1438169132528273974== Content-Type: application/json; charset=\"utf-8\" MIME-Version: 1.0 Content-ID: snippet { \"title\": \"My updated snippet\", \"files\": { \"foo.txt\": {} } } --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"foo.txt\" Content-Disposition: attachment; filename=\"foo.txt\" Updated file contents. --===============1438169132528273974==-- Here only the parts that are changed are included in the body. The other files remain untouched. Note the use of the `files` list in the JSON part. This list contains the files that are being manipulated. This list should have corresponding multiparts in the request that contain the new contents of these files. If a filename in the `files` list does not have a corresponding part, it will be deleted from the snippet, as shown below: PUT /2.0/snippets/evzijst/kypj HTTP/1.1 Content-Length: 188 Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\" MIME-Version: 1.0 --===============1438169132528273974== Content-Type: application/json; charset=\"utf-8\" MIME-Version: 1.0 Content-ID: snippet { \"files\": { \"image.png\": {} } } --===============1438169132528273974==-- To simulate a rename, delete a file and add the same file under another name: PUT /2.0/snippets/evzijst/kypj HTTP/1.1 Content-Length: 212 Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\" MIME-Version: 1.0 --===============1438169132528273974== Content-Type: application/json; charset=\"utf-8\" MIME-Version: 1.0 Content-ID: snippet { \"files\": { \"foo.txt\": {}, \"bar.txt\": {} } } --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"bar.txt\" Content-Disposition: attachment; filename=\"bar.txt\" foo --===============1438169132528273974==-- multipart/form-data ----------------- Again, one can also use `multipart/form-data` to manipulate file contents and meta data atomically. $ curl -X PUT http://localhost:12345/2.0/snippets/evzijst/kypj -F title=\"My updated snippet\" -F file=@foo.txt PUT /2.0/snippets/evzijst/kypj HTTP/1.1 Content-Length: 351 Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"file\"; filename=\"foo.txt\" Content-Type: text/plain foo ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"title\" My updated snippet ------------------------------63a4b224c59f To delete a file, omit its contents while including its name in the `files` field: $ curl -X PUT https://api.bitbucket.org/2.0/snippets/evzijst/kypj -F files=image.png PUT /2.0/snippets/evzijst/kypj HTTP/1.1 Content-Length: 149 Content-Type: multipart/form-data; boundary=----------------------------ef8871065a86 ------------------------------ef8871065a86 Content-Disposition: form-data; name=\"files\" image.png ------------------------------ef8871065a86-- The explicit use of the `files` element in `multipart/related` and `multipart/form-data` is only required when deleting files. The default mode of operation is for file parts to be processed, regardless of whether or not they are listed in `files`, as a convenience to the client. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet's id. | + +### Return type + +[**Snippet**](snippet.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json, multipart/related, multipart/form-data + - **Accept**: application/json, multipart/related, multipart/form-data + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdRevisionDiffGet** +> SnippetsUsernameEncodedIdRevisionDiffGet(ctx, username, encodedId, revision, optional) + + +Returns the diff of the specified commit against its first parent. Note that this resource is different in functionality from the `patch` resource. The differences between a diff and a patch are: * patches have a commit header with the username, message, etc * diffs support the optional `path=foo/bar.py` query param to filter the diff to just that one file diff (not supported for patches) * for a merge, the diff will show the diff between the merge commit and its first parent (identical to how PRs work), while patch returns a response containing separate patches for each commit on the second parent's ancestry, up to the oldest common ancestor (identical to its reachability). Note that the character encoding of the contents of the diff is unspecified as Git and Mercurial do not track this, making it hard for Bitbucket to reliably determine this. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet id. | + **revision** | **string**| A revspec expression. This can simply be a commit SHA1, a ref name, or a compare expression like `staging..production`. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **encodedId** | **string**| The snippet id. | + **revision** | **string**| A revspec expression. This can simply be a commit SHA1, a ref name, or a compare expression like `staging..production`. | + **path** | **string**| When used, only one the diff of the specified file will be returned. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdRevisionPatchGet** +> SnippetsUsernameEncodedIdRevisionPatchGet(ctx, username, encodedId, revision) + + +Returns the patch of the specified commit against its first parent. Note that this resource is different in functionality from the `diff` resource. The differences between a diff and a patch are: * patches have a commit header with the username, message, etc * diffs support the optional `path=foo/bar.py` query param to filter the diff to just that one file diff (not supported for patches) * for a merge, the diff will show the diff between the merge commit and its first parent (identical to how PRs work), while patch returns a response containing separate patches for each commit on the second parent's ancestry, up to the oldest common ancestor (identical to its reachability). Note that the character encoding of the contents of the patch is unspecified as Git and Mercurial do not track this, making it hard for Bitbucket to reliably determine this. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet id. | + **revision** | **string**| A revspec expression. This can simply be a commit SHA1, a ref name, or a compare expression like `staging..production`. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdWatchDelete** +> PaginatedUsers SnippetsUsernameEncodedIdWatchDelete(ctx, username, encodedId) + + +Used to stop watching a specific snippet. Returns 204 (No Content) to indicate success. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet id. | + +### Return type + +[**PaginatedUsers**](paginated_users.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdWatchGet** +> PaginatedUsers SnippetsUsernameEncodedIdWatchGet(ctx, username, encodedId) + + +Used to check if the current user is watching a specific snippet. Returns 204 (No Content) if the user is watching the snippet and 404 if not. Hitting this endpoint anonymously always returns a 404. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet id. | + +### Return type + +[**PaginatedUsers**](paginated_users.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdWatchPut** +> PaginatedUsers SnippetsUsernameEncodedIdWatchPut(ctx, username, encodedId) + + +Used to start watching a specific snippet. Returns 204 (No Content). + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet id. | + +### Return type + +[**PaginatedUsers**](paginated_users.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameEncodedIdWatchersGet** +> PaginatedUsers SnippetsUsernameEncodedIdWatchersGet(ctx, username, encodedId) + + +Returns a paginated list of all users watching a specific snippet. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **encodedId** | **string**| The snippet id. | + +### Return type + +[**PaginatedUsers**](paginated_users.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernameGet** +> PaginatedSnippets SnippetsUsernameGet(ctx, username, optional) + + +Identical to `/snippets`, except that the result is further filtered by the snippet owner and only those that are owned by `{username}` are returned. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| Limits the result to snippets owned by this user. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| Limits the result to snippets owned by this user. | + **role** | **string**| Filter down the result based on the authenticated user's role (`owner`, `contributor`, or `member`). | + +### Return type + +[**PaginatedSnippets**](paginated_snippets.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **SnippetsUsernamePost** +> Snippet SnippetsUsernamePost(ctx, username, body) + + +Identical to `/snippets`, except that the new snippet will be created under the account specified in the path parameter `{username}`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **body** | [**Snippet**](Snippet.md)| The new snippet object. | + +### Return type + +[**Snippet**](snippet.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/SourceApi.md b/docs/SourceApi.md new file mode 100644 index 0000000..6810e19 --- /dev/null +++ b/docs/SourceApi.md @@ -0,0 +1,185 @@ +# \SourceApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**RepositoriesUsernameRepoSlugFilehistoryNodePathGet**](SourceApi.md#RepositoriesUsernameRepoSlugFilehistoryNodePathGet) | **Get** /repositories/{username}/{repo_slug}/filehistory/{node}/{path} | +[**RepositoriesUsernameRepoSlugSrcGet**](SourceApi.md#RepositoriesUsernameRepoSlugSrcGet) | **Get** /repositories/{username}/{repo_slug}/src | +[**RepositoriesUsernameRepoSlugSrcNodePathGet**](SourceApi.md#RepositoriesUsernameRepoSlugSrcNodePathGet) | **Get** /repositories/{username}/{repo_slug}/src/{node}/{path} | +[**RepositoriesUsernameRepoSlugSrcPost**](SourceApi.md#RepositoriesUsernameRepoSlugSrcPost) | **Post** /repositories/{username}/{repo_slug}/src | + + +# **RepositoriesUsernameRepoSlugFilehistoryNodePathGet** +> PaginatedFiles RepositoriesUsernameRepoSlugFilehistoryNodePathGet(ctx, username, node, path, repoSlug, optional) + + +Returns a paginated list of commits that modified the specified file. Commits are returned in reverse chronological order. This is roughly equivalent to the following commands: $ git log --follow --date-order $ hg log --follow By default, Bitbucket will follow renames and the path name in the returned entries reflects that. This can be turned off using the `?renames=false` query parameter. Results are returned in descending chronological order by default, and like most endpoints you can [filter and sort](../../../../../../meta/filtering) the response to only provide exactly the data you want. For example, if you wanted to find commits made before 2011-05-18 against a file named `README.rst`, but you only wanted the path and date, your query would look like this: ``` $ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\\ '?fields=values.next,values.path,values.commit.date&q=commit.date<=2011-05-18' { \"values\": [ { \"commit\": { \"date\": \"2011-05-17T07:32:09+00:00\" }, \"path\": \"README.rst\" }, { \"commit\": { \"date\": \"2011-05-16T06:33:28+00:00\" }, \"path\": \"README.txt\" }, { \"commit\": { \"date\": \"2011-05-16T06:15:39+00:00\" }, \"path\": \"README.txt\" } ] } ``` In the response you can see that the file was renamed to `README.rst` by the commit made on 2011-05-16, and was previously named `README.txt`. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **node** | **string**| | + **path** | **string**| | + **repoSlug** | **string**| | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **node** | **string**| | + **path** | **string**| | + **repoSlug** | **string**| | + **renames** | **string**| When `true`, Bitbucket will follow the history of the file across renames (this is the default behavior). This can be turned off by specifying `false`. | + **q** | **string**| Query string to narrow down the response as per [filtering and sorting](../../../../../../meta/filtering). | + **sort** | **string**| Name of a response property sort the result by as per [filtering and sorting](../../../../../../meta/filtering#query-sort). | + +### Return type + +[**PaginatedFiles**](paginated_files.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugSrcGet** +> PaginatedTreeentries RepositoriesUsernameRepoSlugSrcGet(ctx, username, repoSlug, optional) + + +This endpoint redirects the client to the directory listing of the root directory on the main branch. This is equivalent to directly hitting [/2.0/repositories/{username}/{repo_slug}/src/{node}/{path}](src/%7Bnode%7D/%7Bpath%7D) without having to know the name or SHA1 of the repo's main branch. To create new commits, [POST to this endpoint](#post) + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **repoSlug** | **string**| | + **format** | **string**| Instead of returning the file's contents, return the (json) meta data for it. | + +### Return type + +[**PaginatedTreeentries**](paginated_treeentries.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugSrcNodePathGet** +> PaginatedTreeentries RepositoriesUsernameRepoSlugSrcNodePathGet(ctx, username, node, path, repoSlug, optional) + + +This endpoints is used to retrieve the contents of a single file, or the contents of a directory at a specified revision. ## Raw file contents When `path` points to a file, this endpoint returns the raw contents. The response's Content-Type is derived from the filename extension (not from the contents). The file contents are not processed and no character encoding/recoding is performed and as a result no character encoding is included as part of the Content-Type. The `Content-Disposition` header will be \"attachment\" to prevent browsers from running executable files. If the file is managed by LFS, then a 301 redirect pointing to Atlassian's media services platform is returned. The response includes an ETag that is based on the contents of the file and its attributes. This means that an empty `__init__.py` always returns the same ETag, regardless on the directory it lives in, or the commit it is on. ## File meta data When the request for a file path includes the query parameter `?format=meta`, instead of returning the file's raw contents, Bitbucket instead returns the JSON object describing the file's properties: ```javascript $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests/__init__.py?format=meta { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\" } }, \"path\": \"tests/__init__.py\", \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } }, \"attributes\": [], \"type\": \"commit_file\", \"size\": 0 } ``` File objects contain an `attributes` element that contains a list of possible modifiers. Currently defined values are: * `link` -- indicates that the entry is a symbolic link. The contents of the file represent the path the link points to. * `executable` -- indicates that the file has the executable bit set. * `subrepository` -- indicates that the entry points to a submodule or subrepo. The contents of the file is the SHA1 of the repository pointed to. * `binary` -- indicates whether Bitbucket thinks the file is binary. This endpoint can provide an alternative to how a HEAD request can be used to check for the existence of a file, or a file's size without incurring the overhead of receiving its full contents. ## Directory listings When `path` points to a directory instead of a file, the response is a paginated list of directory and file objects in the same order as the underlying SCM system would return them. For example: ```javascript $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests { \"pagelen\": 10, \"values\": [ { \"path\": \"tests/test_project\", \"type\": \"commit_directory\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\" } }, \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } } }, { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\" } }, \"path\": \"tests/__init__.py\", \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } }, \"attributes\": [], \"type\": \"commit_file\", \"size\": 0 } ], \"page\": 1, \"size\": 2 } ``` When listing the contents of the repo's root directory, the use of a trailing slash at the end of the URL is required. The response is not recursive, meaning that only the direct contents of a path are returned. The response does not recurse down into subdirectories. In order to \"walk\" the entire directory tree, the client needs to parse each response and follow the `self` links of each `commit_directory` object. Each returned object is either a `commit_file`, or a `commit_directory`, both of which contain a `path` element. This path is the absolute path from the root of the repository. Each object also contains a `commit` object which embeds the commit the file is on. Note that this is merely the commit that was used in the URL. It is *not* the commit that last modified the file. Directory objects have 2 representations. Their `self` link returns the paginated contents of the directory. The `meta` link on the other hand returns the actual `directory` object itself, e.g.: ```javascript { \"path\": \"tests/test_project\", \"type\": \"commit_directory\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\" } }, \"commit\": { ... } } ``` ## Querying, filtering and sorting Like most API endpoints, this API supports the Bitbucket querying/filtering syntax and so you could filter a directory listing to only include entries that match certain criteria. For instance, to list all binary files over 1kb use the expression: `size > 1024 and attributes = \"binary\"` which after urlencoding yields the query string: `?q=size%3E1024+and+attributes%3D%22binary%22` To change the ordering of the response, use the `?sort` parameter: `.../src/eefd5ef/?sort=-size` See [filtering and sorting](../../../../../../meta/filtering) for more details. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **node** | **string**| | + **path** | **string**| | + **repoSlug** | **string**| | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **node** | **string**| | + **path** | **string**| | + **repoSlug** | **string**| | + **format** | **string**| If 'meta' is provided, returns the (json) meta data for the contents of the file. If 'rendered' is provided, returns the contents of a non-binary file in HTML-formatted rendered markup. Since Git and Mercurial do not generally track what text encoding scheme is used, this endpoint attempts to detect the most appropriate character encoding. While usually correct, determining the character encoding can be ambiguous which in exceptional cases can lead to misinterpretation of the characters. As such, the raw element in the response object should not be treated as equivalent to the file's actual contents. | + **q** | **string**| Optional filter expression as per [filtering and sorting](../../../../../../meta/filtering). | + **sort** | **string**| Optional sorting parameter as per [filtering and sorting](../../../../../../meta/filtering#query-sort). | + +### Return type + +[**PaginatedTreeentries**](paginated_treeentries.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugSrcPost** +> RepositoriesUsernameRepoSlugSrcPost(ctx, username, repoSlug, optional) + + +This endpoint is used to create new commits in the repository by uploading files. To add a new file to a repository: ``` $ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \\ -F /repo/path/to/image.png=@image.png ``` This will create a new commit on top of the main branch, inheriting the contents of the main branch, but adding (or overwriting) the `image.png` file to the repository in the `/repo/path/to` directory. This endpoint accepts `multipart/form-data` (as in the example above), as well as `application/x-www-form-urlencoded`. ## multipart/form-data A `multipart/form-data` post contains a series of \"form fields\" that identify both the individual files that are being uploaded, as well as additional, optional meta data. Files are uploaded in file form fields (those that have a `Content-Disposition` parameter) whose field names point to the remote path in the repository where the file should be stored. Path field names are always interpreted to be absolute from the root of the repository, regardless whether the client uses a leading slash (as the above `curl` example did). File contents are treated as bytes and are not decoded as text. The commit message, as well as other non-file meta data for the request, is sent along as normal form field elements. Meta data fields share the same namespace as the file objects. For `multipart/form-data` bodies that should not lead to any ambiguity, as the `Content-Disposition` header will contain the `filename` parameter to distinguish between a file named \"message\" and the commit message field. ## application/x-www-form-urlencoded It is also possible to upload new files using a simple `application/x-www-form-urlencoded` POST. This can be convenient when uploading pure text files: ``` $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/ \\ --data-urlencode \"/path/to/me.txt=Lorem ipsum.\" \\ --data-urlencode \"message=Initial commit\" \\ --data-urlencode \"author=Erik van Zijst \" ``` There could be a field name clash if a client were to upload a file named \"message\", as this filename clashes with the meta data property for the commit message. To avoid this and to upload files whose names clash with the meta data properties, use a leading slash for the files, e.g. `curl --data-urlencode \"/message=file contents\"`. When an explicit slash is omitted for a file whose path matches that of a meta data parameter, then it is interpreted as meta data, not as a file. ## Executables and links While this API aims to facilitate the most common use cases, it is possible to perform some more advanced operations like creating a new symlink in the repository, or creating an executable file. Files can be supplied with a `x-attributes` value in the `Content-Disposition` header. For example, to upload an executable file, as well as create a symlink from `README.txt` to `README`: ``` --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"bin/shutdown.sh\" Content-Disposition: attachment; filename=\"shutdown.sh\"; x-attributes:\"executable\" #!/bin/sh halt --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"/README.txt\" Content-Disposition: attachment; filename=\"README.txt\"; x-attributes:\"link\" README --===============1438169132528273974==-- ``` Links are files that contain the target path and have `x-attributes:\"link\"` set. When overwriting links with files, or vice versa, the newly uploaded file determines both the new contents, as well as the attributes. That means uploading a file without specifying `x-attributes=\"link\"` will create a regular file, even if the parent commit hosted a symlink at the same path. The same applies to executables. When modifying an existing executable file, the form-data file element must include `x-attributes=\"executable\"` in order to preserve the executable status of the file. Note that this API does not support the creation or manipulation of subrepos / submodules. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| | + **repoSlug** | **string**| | + **message** | **string**| The commit message. When omitted, Bitbucket uses a canned string. | + **author** | **string**| The raw string to be used as the new commit's author. This string follows the format `Erik van Zijst <evzijst@atlassian.com>`. When omitted, Bitbucket uses the authenticated user's full/display name and primary email address. Commits cannot be created anonymously. | + **parents** | **string**| A comma-separated list of SHA1s of the commits that should be the parents of the newly created commit. When omitted, the new commit will inherit from and become a child of the main branch's tip/HEAD commit. When more than one SHA1 is provided, the first SHA1 identifies the commit from which the content will be inherited. When more than 2 parents are provided on a Mercurial repo, a 400 is returned as Mercurial does not support \"octopus merges\". | + **files** | **string**| Optional field that declares the files that the request is manipulating. When adding a new file to a repo, or when overwriting an existing file, the client can just upload the full contents of the file in a normal form field and the use of this `files` meta data field is redundant. However, when the `files` field contains a file path that does not have a corresponding, identically-named form field, then Bitbucket interprets that as the client wanting to replace the named file with the null set and the file is deleted instead. Paths in the repo that are referenced in neither files nor an individual file field, remain unchanged and carry over from the parent to the new commit. This API does not support renaming as an explicit feature. To rename a file, simply delete it and recreate it under the new name in the same commit. | + **files2** | **string**| The name of the branch that the new commit should be created on. When omitted, the commit will be created on top of the main branch and will become the main branch's new HEAD/tip. When a branch name is provided that already exists in the repo, then the commit will be created on top of that branch. In this case, if a parent SHA1 was also provided, then it is asserted that the parent is the branch's tip/HEAD at the time the request is made. When this is not the case, a 409 is returned. This API cannot be used to create new anonymous heads in Mercurial repos. When a new branch name is specified (that does not already exist in the repo), and no parent SHA1s are provided, then the new commit will inherit from the current main branch's tip/HEAD commit, but not advance the main branch. The new commit will be the new branch. When the request also specifies a parent SHA1, then the new commit and branch are created directly on top of the parent commit, regardless of the state of the main branch. When a branch name is not specified, but a parent SHA1 is provided, then Bitbucket asserts that it represents the main branch's current HEAD/tip, or a 409 is returned. When a branch name is not specified and the repo is empty, the new commit will become the repo's root commit and will be on the main branch. When a branch name is specified and the repo is empty, the new commit will become the repo's root commit and also define the repo's main branch going forward. This API cannot be used to create additional root commits in non-empty repos. The branch field cannot be repeated. As a side effect, this API can be used to create a new branch without modifying any files, by specifying a new branch name in this field, together with parents, but omitting the files fields, while not sending any files. This will create a new commit and branch with the same contents as the first parent. The diff of this commit against its first parent will be empty. | + **branch** | **string**| The name of the branch that the new commit should be created on. When omitted, the commit will be created on top of the main branch and will become the main branch's new head. When a branch name is provided that already exists in the repo, then the commit will be created on top of that branch. In this case, *if* a parent SHA1 was also provided, then it is asserted that the parent is the branch's tip/HEAD at the time the request is made. When this is not the case, a 409 is returned. This API cannot be used to create new anonymous heads in Mercurial repositories. When a new branch name is specified (that does not already exist in the repo), and no parent SHA1s are provided, then the new commit will inherit from the current main branch's tip/HEAD commit, but not advance the main branch. The new commit will be the new branch. When the request *also* specifies a parent SHA1, then the new commit and branch are created directly on top of the parent commit, regardless of the state of the main branch. When a branch name is not specified, but a parent SHA1 is provided, then Bitbucket asserts that it represents the main branch's current HEAD/tip, or a 409 is returned. When a branch name is not specified and the repo is empty, the new commit will become the repo's root commit and will be on the main branch. When a branch name is specified and the repo is empty, the new commit will become the repo's root commit and also define the repo's main branch going forward. This API cannot be used to create additional root commits in non-empty repos. The branch field cannot be repeated. As a side effect, this API can be used to create a new branch without modifying any files, by specifying a new branch name in this field, together with `parents`, but omitting the `files` fields, while not sending any files. This will create a new commit and branch with the same contents as the first parent. The diff of this commit against its first parent will be empty. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/SshAccountKey.md b/docs/SshAccountKey.md new file mode 100644 index 0000000..3cce956 --- /dev/null +++ b/docs/SshAccountKey.md @@ -0,0 +1,18 @@ +# SshAccountKey + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Uuid** | **string** | The SSH key's immutable ID. | [optional] [default to null] +**Key** | **string** | The SSH public key value in OpenSSH format. | [optional] [default to null] +**Comment** | **string** | The comment parsed from the SSH key (if present) | [optional] [default to null] +**Label** | **string** | The user-defined label for the SSH key | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**LastUsed** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Links** | [***MilestoneLinks**](milestone_links.md) | | [optional] [default to null] +**Owner** | [***Account**](account.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SshApi.md b/docs/SshApi.md new file mode 100644 index 0000000..2a7e18a --- /dev/null +++ b/docs/SshApi.md @@ -0,0 +1,175 @@ +# \SshApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**UsersUsernameSshKeysDelete**](SshApi.md#UsersUsernameSshKeysDelete) | **Delete** /users/{username}/ssh-keys/ | +[**UsersUsernameSshKeysGet**](SshApi.md#UsersUsernameSshKeysGet) | **Get** /users/{username}/ssh-keys/ | +[**UsersUsernameSshKeysGet_0**](SshApi.md#UsersUsernameSshKeysGet_0) | **Get** /users/{username}/ssh-keys | +[**UsersUsernameSshKeysPost**](SshApi.md#UsersUsernameSshKeysPost) | **Post** /users/{username}/ssh-keys | +[**UsersUsernameSshKeysPut**](SshApi.md#UsersUsernameSshKeysPut) | **Put** /users/{username}/ssh-keys/ | + + +# **UsersUsernameSshKeysDelete** +> UsersUsernameSshKeysDelete(ctx, username, keyId) + + +Deletes a specific SSH public key from a user's account Example: ``` $ curl -X DELETE https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a} ``` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account's username or UUID. | + **keyId** | **string**| The SSH key's UUID value. | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameSshKeysGet** +> SshAccountKey UsersUsernameSshKeysGet(ctx, username, keyId) + + +Returns a specific SSH public key belonging to a user. Example: ``` $ curl https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/{fbe4bbab-f6f7-4dde-956b-5c58323c54b3} { \"comment\": \"user@myhost\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ``` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account's username or UUID. | + **keyId** | **string**| The SSH key's UUID value. | + +### Return type + +[**SshAccountKey**](ssh_account_key.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameSshKeysGet_0** +> PaginatedSshUserKeys UsersUsernameSshKeysGet_0(ctx, username) + + +Returns a paginated list of the user's SSH public keys. Example: ``` $ curl https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys { \"page\": 1, \"pagelen\": 10, \"size\": 1, \"values\": [ { \"comment\": \"user@myhost\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ] } ``` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account's username or UUID. | + +### Return type + +[**PaginatedSshUserKeys**](paginated_ssh_user_keys.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameSshKeysPost** +> SshAccountKey UsersUsernameSshKeysPost(ctx, username, optional) + + +Adds a new SSH public key to the specified user account and returns the resulting key. Example: ``` $ curl -X POST -H \"Content-Type: application/json\" -d '{\"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY user@myhost\"}' https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys { \"comment\": \"user@myhost\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ``` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account's username or UUID. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The account's username or UUID. | + **body** | [**SshAccountKey**](SshAccountKey.md)| The new SSH key object | + +### Return type + +[**SshAccountKey**](ssh_account_key.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameSshKeysPut** +> SshAccountKey UsersUsernameSshKeysPut(ctx, username, keyId, optional) + + +Updates a specific SSH public key on a user's account Note: Only the 'comment' field can be updated using this API. To modify the key or comment values, you must delete and add the key again. Example: ``` $ curl -X PUT -H \"Content-Type: application/json\" -d '{\"label\": \"Work key\"}' https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a} { \"comment\": \"\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"Work key\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ``` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account's username or UUID. | + **keyId** | **string**| The SSH key's UUID value. | + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The account's username or UUID. | + **keyId** | **string**| The SSH key's UUID value. | + **body** | [**SshAccountKey**](SshAccountKey.md)| The updated SSH key object | + +### Return type + +[**SshAccountKey**](ssh_account_key.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/SshKey.md b/docs/SshKey.md new file mode 100644 index 0000000..6f7be68 --- /dev/null +++ b/docs/SshKey.md @@ -0,0 +1,17 @@ +# SshKey + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Uuid** | **string** | The SSH key's immutable ID. | [optional] [default to null] +**Key** | **string** | The SSH public key value in OpenSSH format. | [optional] [default to null] +**Comment** | **string** | The comment parsed from the SSH key (if present) | [optional] [default to null] +**Label** | **string** | The user-defined label for the SSH key | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**LastUsed** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Links** | [***MilestoneLinks**](milestone_links.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SubjectTypes.md b/docs/SubjectTypes.md new file mode 100644 index 0000000..4062d12 --- /dev/null +++ b/docs/SubjectTypes.md @@ -0,0 +1,12 @@ +# SubjectTypes + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Repository** | [***SubjectTypesRepository**](subject_types_repository.md) | | [optional] [default to null] +**User** | [***SubjectTypesRepository**](subject_types_repository.md) | | [optional] [default to null] +**Team** | [***SubjectTypesRepository**](subject_types_repository.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SubjectTypesRepository.md b/docs/SubjectTypesRepository.md new file mode 100644 index 0000000..4185b93 --- /dev/null +++ b/docs/SubjectTypesRepository.md @@ -0,0 +1,10 @@ +# SubjectTypesRepository + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Events** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Tag.md b/docs/Tag.md new file mode 100644 index 0000000..e8131ec --- /dev/null +++ b/docs/Tag.md @@ -0,0 +1,16 @@ +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***TagLinks**](tag_links.md) | | [optional] [default to null] +**Name** | **string** | The name of the tag. | [optional] [default to null] +**Target** | [***Commit**](commit.md) | | [optional] [default to null] +**Message** | **string** | The message associated with the tag, if available. | [optional] [default to null] +**Date** | [**time.Time**](time.Time.md) | The date that the tag was created, if available | [optional] [default to null] +**Tagger** | [***Author**](author.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TagLinks.md b/docs/TagLinks.md new file mode 100644 index 0000000..2a8fa7a --- /dev/null +++ b/docs/TagLinks.md @@ -0,0 +1,12 @@ +# TagLinks + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Self** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Commits** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] +**Html** | [***MilestoneLinksSelf**](milestone_links_self.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Team.md b/docs/Team.md new file mode 100644 index 0000000..5076f1a --- /dev/null +++ b/docs/Team.md @@ -0,0 +1,16 @@ +# Team + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***AccountLinks**](account_links.md) | | [optional] [default to null] +**Username** | **string** | | [optional] [default to null] +**DisplayName** | **string** | | [optional] [default to null] +**Website** | **string** | | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Uuid** | **string** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TeamPermission.md b/docs/TeamPermission.md new file mode 100644 index 0000000..a5fe096 --- /dev/null +++ b/docs/TeamPermission.md @@ -0,0 +1,13 @@ +# TeamPermission + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Permission** | **string** | | [optional] [default to null] +**User** | [***User**](user.md) | | [optional] [default to null] +**Team** | [***Team**](team.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TeamsApi.md b/docs/TeamsApi.md new file mode 100644 index 0000000..1f7be17 --- /dev/null +++ b/docs/TeamsApi.md @@ -0,0 +1,366 @@ +# \TeamsApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TeamsGet**](TeamsApi.md#TeamsGet) | **Get** /teams | +[**TeamsUsernameFollowersGet**](TeamsApi.md#TeamsUsernameFollowersGet) | **Get** /teams/{username}/followers | +[**TeamsUsernameFollowingGet**](TeamsApi.md#TeamsUsernameFollowingGet) | **Get** /teams/{username}/following | +[**TeamsUsernameGet**](TeamsApi.md#TeamsUsernameGet) | **Get** /teams/{username} | +[**TeamsUsernameHooksGet**](TeamsApi.md#TeamsUsernameHooksGet) | **Get** /teams/{username}/hooks | +[**TeamsUsernameHooksPost**](TeamsApi.md#TeamsUsernameHooksPost) | **Post** /teams/{username}/hooks | +[**TeamsUsernameHooksUidDelete**](TeamsApi.md#TeamsUsernameHooksUidDelete) | **Delete** /teams/{username}/hooks/{uid} | +[**TeamsUsernameHooksUidGet**](TeamsApi.md#TeamsUsernameHooksUidGet) | **Get** /teams/{username}/hooks/{uid} | +[**TeamsUsernameHooksUidPut**](TeamsApi.md#TeamsUsernameHooksUidPut) | **Put** /teams/{username}/hooks/{uid} | +[**TeamsUsernameMembersGet**](TeamsApi.md#TeamsUsernameMembersGet) | **Get** /teams/{username}/members | +[**TeamsUsernameRepositoriesGet**](TeamsApi.md#TeamsUsernameRepositoriesGet) | **Get** /teams/{username}/repositories | +[**UsersUsernameRepositoriesGet**](TeamsApi.md#UsersUsernameRepositoriesGet) | **Get** /users/{username}/repositories | + + +# **TeamsGet** +> PaginatedTeams TeamsGet(ctx, optional) + + +Returns all the teams that the authenticated user is associated with. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **optional** | **map[string]interface{}** | optional parameters | nil if no parameters + +### Optional Parameters +Optional parameters are passed through a map[string]interface{}. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **role** | **string**| Filters the teams based on the authenticated user's role on each team. * **member**: returns a list of all the teams which the caller is a member of at least one team group or repository owned by the team * **contributor**: returns a list of teams which the caller has write access to at least one repository owned by the team * **admin**: returns a list teams which the caller has team administrator access | + +### Return type + +[**PaginatedTeams**](paginated_teams.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameFollowersGet** +> PaginatedUsers TeamsUsernameFollowersGet(ctx, username) + + +Returns the list of accounts that are following this team. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The team's username | + +### Return type + +[**PaginatedUsers**](paginated_users.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameFollowingGet** +> PaginatedUsers TeamsUsernameFollowingGet(ctx, username) + + +Returns the list of accounts this team is following. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The team's username | + +### Return type + +[**PaginatedUsers**](paginated_users.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameGet** +> Team TeamsUsernameGet(ctx, username) + + +Gets the public information associated with a team. If the team's profile is private, `location`, `website` and `created_on` elements are omitted. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The team's username or UUID. | + +### Return type + +[**Team**](team.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameHooksGet** +> PaginatedWebhookSubscriptions TeamsUsernameHooksGet(ctx, username) + + +Returns a paginated list of webhooks installed on this team. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**PaginatedWebhookSubscriptions**](paginated_webhook_subscriptions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameHooksPost** +> WebhookSubscription TeamsUsernameHooksPost(ctx, username) + + +Creates a new webhook on the specified team. Team webhooks are fired for events from all repositories belonging to that team account. Note that only admins can install webhooks on teams. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameHooksUidDelete** +> TeamsUsernameHooksUidDelete(ctx, username, uid) + + +Deletes the specified webhook subscription from the given team account. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameHooksUidGet** +> WebhookSubscription TeamsUsernameHooksUidGet(ctx, username, uid) + + +Returns the webhook with the specified id installed on the given team account. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id. | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameHooksUidPut** +> WebhookSubscription TeamsUsernameHooksUidPut(ctx, username, uid) + + +Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameMembersGet** +> User TeamsUsernameMembersGet(ctx, username) + + +All members of a team. Returns all members of the specified team. Any member of any of the team's groups is considered a member of the team. This includes users in groups that may not actually have access to any of the team's repositories. Note that members using the \"private profile\" feature are not included. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**User**](user.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameRepositoriesGet** +> ModelError TeamsUsernameRepositoriesGet(ctx, username) + + +All repositories owned by a user/team. This includes private repositories, but filtered down to the ones that the calling user has access to. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameRepositoriesGet** +> ModelError UsersUsernameRepositoriesGet(ctx, username) + + +All repositories owned by a user/team. This includes private repositories, but filtered down to the ones that the calling user has access to. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Treeentry.md b/docs/Treeentry.md new file mode 100644 index 0000000..44403c8 --- /dev/null +++ b/docs/Treeentry.md @@ -0,0 +1,12 @@ +# Treeentry + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Path** | **string** | The path in the repository | [optional] [default to null] +**Commit** | [***Commit**](commit.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/User.md b/docs/User.md new file mode 100644 index 0000000..c23909e --- /dev/null +++ b/docs/User.md @@ -0,0 +1,18 @@ +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***AccountLinks**](account_links.md) | | [optional] [default to null] +**Username** | **string** | | [optional] [default to null] +**DisplayName** | **string** | | [optional] [default to null] +**Website** | **string** | | [optional] [default to null] +**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Uuid** | **string** | | [optional] [default to null] +**IsStaff** | **bool** | | [optional] [default to null] +**AccountId** | **string** | The user's Atlassian account ID. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UsersApi.md b/docs/UsersApi.md new file mode 100644 index 0000000..44d1b21 --- /dev/null +++ b/docs/UsersApi.md @@ -0,0 +1,380 @@ +# \UsersApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TeamsUsernameRepositoriesGet**](UsersApi.md#TeamsUsernameRepositoriesGet) | **Get** /teams/{username}/repositories | +[**UserEmailsEmailGet**](UsersApi.md#UserEmailsEmailGet) | **Get** /user/emails/{email} | +[**UserEmailsGet**](UsersApi.md#UserEmailsGet) | **Get** /user/emails | +[**UserGet**](UsersApi.md#UserGet) | **Get** /user | +[**UsersUsernameFollowersGet**](UsersApi.md#UsersUsernameFollowersGet) | **Get** /users/{username}/followers | +[**UsersUsernameFollowingGet**](UsersApi.md#UsersUsernameFollowingGet) | **Get** /users/{username}/following | +[**UsersUsernameGet**](UsersApi.md#UsersUsernameGet) | **Get** /users/{username} | +[**UsersUsernameHooksGet**](UsersApi.md#UsersUsernameHooksGet) | **Get** /users/{username}/hooks | +[**UsersUsernameHooksPost**](UsersApi.md#UsersUsernameHooksPost) | **Post** /users/{username}/hooks | +[**UsersUsernameHooksUidDelete**](UsersApi.md#UsersUsernameHooksUidDelete) | **Delete** /users/{username}/hooks/{uid} | +[**UsersUsernameHooksUidGet**](UsersApi.md#UsersUsernameHooksUidGet) | **Get** /users/{username}/hooks/{uid} | +[**UsersUsernameHooksUidPut**](UsersApi.md#UsersUsernameHooksUidPut) | **Put** /users/{username}/hooks/{uid} | +[**UsersUsernameRepositoriesGet**](UsersApi.md#UsersUsernameRepositoriesGet) | **Get** /users/{username}/repositories | + + +# **TeamsUsernameRepositoriesGet** +> ModelError TeamsUsernameRepositoriesGet(ctx, username) + + +All repositories owned by a user/team. This includes private repositories, but filtered down to the ones that the calling user has access to. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UserEmailsEmailGet** +> ModelError UserEmailsEmailGet(ctx, email) + + +Returns details about a specific one of the authenticated user's email addresses. Details describe whether the address has been confirmed by the user and whether it is the user's primary address or not. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **email** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UserEmailsGet** +> ModelError UserEmailsGet(ctx, ) + + +Returns all the authenticated user's email addresses. Both confirmed and unconfirmed. + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UserGet** +> User UserGet(ctx, ) + + +Returns the currently logged in user. + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**User**](user.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameFollowersGet** +> PaginatedUsers UsersUsernameFollowersGet(ctx, username) + + +Returns the list of accounts that are following this team. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account's username | + +### Return type + +[**PaginatedUsers**](paginated_users.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameFollowingGet** +> PaginatedUsers UsersUsernameFollowingGet(ctx, username) + + +Returns the list of accounts this user is following. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The user's username | + +### Return type + +[**PaginatedUsers**](paginated_users.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameGet** +> User UsersUsernameGet(ctx, username) + + +Gets the public information associated with a user account. If the user's profile is private, `location`, `website` and `created_on` elements are omitted. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| The account's username or UUID. | + +### Return type + +[**User**](user.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameHooksGet** +> PaginatedWebhookSubscriptions UsersUsernameHooksGet(ctx, username) + + +Returns a paginated list of webhooks installed on this user account. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**PaginatedWebhookSubscriptions**](paginated_webhook_subscriptions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameHooksPost** +> WebhookSubscription UsersUsernameHooksPost(ctx, username) + + +Creates a new webhook on the specified user account. Account-level webhooks are fired for events from all repositories belonging to that account. Note that one can only register webhooks on one's own account, not that of others. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameHooksUidDelete** +> UsersUsernameHooksUidDelete(ctx, username, uid) + + +Deletes the specified webhook subscription from the given user account. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameHooksUidGet** +> WebhookSubscription UsersUsernameHooksUidGet(ctx, username, uid) + + +Returns the webhook with the specified id installed on the given user account. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id. | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameHooksUidPut** +> WebhookSubscription UsersUsernameHooksUidPut(ctx, username, uid) + + +Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameRepositoriesGet** +> ModelError UsersUsernameRepositoriesGet(ctx, username) + + +All repositories owned by a user/team. This includes private repositories, but filtered down to the ones that the calling user has access to. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**ModelError**](error.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Version.md b/docs/Version.md new file mode 100644 index 0000000..235794f --- /dev/null +++ b/docs/Version.md @@ -0,0 +1,13 @@ +# Version + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Links** | [***MilestoneLinks**](milestone_links.md) | | [optional] [default to null] +**Name** | **string** | | [optional] [default to null] +**Id** | **int32** | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebhookSubscription.md b/docs/WebhookSubscription.md new file mode 100644 index 0000000..dd84da9 --- /dev/null +++ b/docs/WebhookSubscription.md @@ -0,0 +1,18 @@ +# WebhookSubscription + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Type_** | **string** | | [default to null] +**Uuid** | **string** | The webhook's id | [optional] [default to null] +**Url** | **string** | The URL events get delivered to. | [optional] [default to null] +**Description** | **string** | A user-defined description of the webhook. | [optional] [default to null] +**SubjectType** | **string** | The type of entity, which is `repository` in the case of webhook subscriptions on repositories. | [optional] [default to null] +**Subject** | [***interface{}**](interface{}.md) | | [optional] [default to null] +**Active** | **bool** | | [optional] [default to null] +**CreatedAt** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Events** | **[]string** | The events this webhook is subscribed to. | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebhooksApi.md b/docs/WebhooksApi.md new file mode 100644 index 0000000..99dcd37 --- /dev/null +++ b/docs/WebhooksApi.md @@ -0,0 +1,511 @@ +# \WebhooksApi + +All URIs are relative to *https://api.bitbucket.org/2.0* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**HookEventsGet**](WebhooksApi.md#HookEventsGet) | **Get** /hook_events | +[**HookEventsSubjectTypeGet**](WebhooksApi.md#HookEventsSubjectTypeGet) | **Get** /hook_events/{subject_type} | +[**RepositoriesUsernameRepoSlugHooksGet**](WebhooksApi.md#RepositoriesUsernameRepoSlugHooksGet) | **Get** /repositories/{username}/{repo_slug}/hooks | +[**RepositoriesUsernameRepoSlugHooksPost**](WebhooksApi.md#RepositoriesUsernameRepoSlugHooksPost) | **Post** /repositories/{username}/{repo_slug}/hooks | +[**RepositoriesUsernameRepoSlugHooksUidDelete**](WebhooksApi.md#RepositoriesUsernameRepoSlugHooksUidDelete) | **Delete** /repositories/{username}/{repo_slug}/hooks/{uid} | +[**RepositoriesUsernameRepoSlugHooksUidGet**](WebhooksApi.md#RepositoriesUsernameRepoSlugHooksUidGet) | **Get** /repositories/{username}/{repo_slug}/hooks/{uid} | +[**RepositoriesUsernameRepoSlugHooksUidPut**](WebhooksApi.md#RepositoriesUsernameRepoSlugHooksUidPut) | **Put** /repositories/{username}/{repo_slug}/hooks/{uid} | +[**TeamsUsernameHooksGet**](WebhooksApi.md#TeamsUsernameHooksGet) | **Get** /teams/{username}/hooks | +[**TeamsUsernameHooksPost**](WebhooksApi.md#TeamsUsernameHooksPost) | **Post** /teams/{username}/hooks | +[**TeamsUsernameHooksUidDelete**](WebhooksApi.md#TeamsUsernameHooksUidDelete) | **Delete** /teams/{username}/hooks/{uid} | +[**TeamsUsernameHooksUidGet**](WebhooksApi.md#TeamsUsernameHooksUidGet) | **Get** /teams/{username}/hooks/{uid} | +[**TeamsUsernameHooksUidPut**](WebhooksApi.md#TeamsUsernameHooksUidPut) | **Put** /teams/{username}/hooks/{uid} | +[**UsersUsernameHooksGet**](WebhooksApi.md#UsersUsernameHooksGet) | **Get** /users/{username}/hooks | +[**UsersUsernameHooksPost**](WebhooksApi.md#UsersUsernameHooksPost) | **Post** /users/{username}/hooks | +[**UsersUsernameHooksUidDelete**](WebhooksApi.md#UsersUsernameHooksUidDelete) | **Delete** /users/{username}/hooks/{uid} | +[**UsersUsernameHooksUidGet**](WebhooksApi.md#UsersUsernameHooksUidGet) | **Get** /users/{username}/hooks/{uid} | +[**UsersUsernameHooksUidPut**](WebhooksApi.md#UsersUsernameHooksUidPut) | **Put** /users/{username}/hooks/{uid} | + + +# **HookEventsGet** +> SubjectTypes HookEventsGet(ctx, ) + + +Returns the webhook resource or subject types on which webhooks can be registered. Each resource/subject type contains an `events` link that returns the paginated list of specific events each individual subject type can emit. This endpoint is publicly accessible and does not require authentication or scopes. Example: ``` $ curl https://api.bitbucket.org/2.0/hook_events { \"repository\": { \"links\": { \"events\": { \"href\": \"https://api.bitbucket.org/2.0/hook_events/repository\" } } }, \"team\": { \"links\": { \"events\": { \"href\": \"https://api.bitbucket.org/2.0/hook_events/team\" } } }, \"user\": { \"links\": { \"events\": { \"href\": \"https://api.bitbucket.org/2.0/hook_events/user\" } } } } ``` + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**SubjectTypes**](subject_types.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **HookEventsSubjectTypeGet** +> PaginatedHookEvents HookEventsSubjectTypeGet(ctx, subjectType) + + +Returns a paginated list of all valid webhook events for the specified entity. This is public data that does not require any scopes or authentication. Example: NOTE: The following example is a truncated response object for the `team` `subject_type`. We return the same structure for the other `subject_type` objects. ``` $ curl https://api.bitbucket.org/2.0/hook_events/team { \"page\": 1, \"pagelen\": 30, \"size\": 21, \"values\": [ { \"category\": \"Repository\", \"description\": \"Whenever a repository push occurs\", \"event\": \"repo:push\", \"label\": \"Push\" }, { \"category\": \"Repository\", \"description\": \"Whenever a repository fork occurs\", \"event\": \"repo:fork\", \"label\": \"Fork\" }, ... { \"category\": \"Repository\", \"description\": \"Whenever a repository import occurs\", \"event\": \"repo:imported\", \"label\": \"Import\" } ] } ``` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **subjectType** | **string**| A resource or subject type. | + +### Return type + +[**PaginatedHookEvents**](paginated_hook_events.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugHooksGet** +> PaginatedWebhookSubscriptions RepositoriesUsernameRepoSlugHooksGet(ctx, username, repoSlug) + + +Returns a paginated list of webhooks installed on this repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**PaginatedWebhookSubscriptions**](paginated_webhook_subscriptions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugHooksPost** +> WebhookSubscription RepositoriesUsernameRepoSlugHooksPost(ctx, username, repoSlug) + + +Creates a new webhook on the specified repository. Example: ``` $ curl -X POST -u credentials -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/repositories/username/slug/hooks -d ' { \"description\": \"Webhook Description\", \"url\": \"https://example.com/\", \"active\": true, \"events\": [ \"repo:push\", \"issue:created\", \"issue:updated\" ] }' ``` Note that this call requires the webhook scope, as well as any scope that applies to the events that the webhook subscribes to. In the example above that means: `webhook`, `repository` and `issue`. Also note that the `url` must properly resolve and cannot be an internal, non-routed address. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugHooksUidDelete** +> RepositoriesUsernameRepoSlugHooksUidDelete(ctx, username, repoSlug, uid) + + +Deletes the specified webhook subscription from the given repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugHooksUidGet** +> WebhookSubscription RepositoriesUsernameRepoSlugHooksUidGet(ctx, username, repoSlug, uid) + + +Returns the webhook with the specified id installed on the specified repository. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **uid** | **string**| The installed webhook's id. | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **RepositoriesUsernameRepoSlugHooksUidPut** +> WebhookSubscription RepositoriesUsernameRepoSlugHooksUidPut(ctx, username, repoSlug, uid) + + +Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **repoSlug** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameHooksGet** +> PaginatedWebhookSubscriptions TeamsUsernameHooksGet(ctx, username) + + +Returns a paginated list of webhooks installed on this team. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**PaginatedWebhookSubscriptions**](paginated_webhook_subscriptions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameHooksPost** +> WebhookSubscription TeamsUsernameHooksPost(ctx, username) + + +Creates a new webhook on the specified team. Team webhooks are fired for events from all repositories belonging to that team account. Note that only admins can install webhooks on teams. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameHooksUidDelete** +> TeamsUsernameHooksUidDelete(ctx, username, uid) + + +Deletes the specified webhook subscription from the given team account. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameHooksUidGet** +> WebhookSubscription TeamsUsernameHooksUidGet(ctx, username, uid) + + +Returns the webhook with the specified id installed on the given team account. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id. | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **TeamsUsernameHooksUidPut** +> WebhookSubscription TeamsUsernameHooksUidPut(ctx, username, uid) + + +Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameHooksGet** +> PaginatedWebhookSubscriptions UsersUsernameHooksGet(ctx, username) + + +Returns a paginated list of webhooks installed on this user account. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**PaginatedWebhookSubscriptions**](paginated_webhook_subscriptions.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameHooksPost** +> WebhookSubscription UsersUsernameHooksPost(ctx, username) + + +Creates a new webhook on the specified user account. Account-level webhooks are fired for events from all repositories belonging to that account. Note that one can only register webhooks on one's own account, not that of others. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameHooksUidDelete** +> UsersUsernameHooksUidDelete(ctx, username, uid) + + +Deletes the specified webhook subscription from the given user account. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + + (empty response body) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameHooksUidGet** +> WebhookSubscription UsersUsernameHooksUidGet(ctx, username, uid) + + +Returns the webhook with the specified id installed on the given user account. + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id. | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UsersUsernameHooksUidPut** +> WebhookSubscription UsersUsernameHooksUidPut(ctx, username, uid) + + +Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + +### Required Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **ctx** | **context.Context** | context for logging, tracing, authentication, etc. + **username** | **string**| | + **uid** | **string**| The installed webhook's id | + +### Return type + +[**WebhookSubscription**](webhook_subscription.md) + +### Authorization + +[api_key](../README.md#api_key), [basic](../README.md#basic), [oauth2](../README.md#oauth2) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/downloads_api.go b/downloads_api.go new file mode 100644 index 0000000..853122f --- /dev/null +++ b/downloads_api.go @@ -0,0 +1,350 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type DownloadsApiService service + + +/* DownloadsApiService + Deletes the specified download artifact from the repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param filename + @param repoSlug + @return ModelError*/ +func (a *DownloadsApiService) RepositoriesUsernameRepoSlugDownloadsFilenameDelete(ctx context.Context, username string, filename string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/downloads/{filename}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"filename"+"}", fmt.Sprintf("%v", filename), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* DownloadsApiService + Return a redirect to the contents of a download artifact. This endpoint returns the actual file contents and not the artifact's metadata. $ curl -s -L https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads/hello.txt Hello World + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param filename + @param repoSlug + @return ModelError*/ +func (a *DownloadsApiService) RepositoriesUsernameRepoSlugDownloadsFilenameGet(ctx context.Context, username string, filename string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/downloads/{filename}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"filename"+"}", fmt.Sprintf("%v", filename), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* DownloadsApiService + Returns a list of download links associated with the repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return ModelError*/ +func (a *DownloadsApiService) RepositoriesUsernameRepoSlugDownloadsGet(ctx context.Context, username string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/downloads" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* DownloadsApiService + Upload new download artifacts. To upload files, perform a `multipart/form-data` POST containing one or more `files` fields: $ echo Hello World > hello.txt $ curl -s -u evzijst -X POST https://api.bitbucket.org/2.0/repositories/evzijst/git-tests/downloads -F files=@hello.txt When a file is uploaded with the same name as an existing artifact, then the existing file will be replaced. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return ModelError*/ +func (a *DownloadsApiService) RepositoriesUsernameRepoSlugDownloadsPost(ctx context.Context, username string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/downloads" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/error_error.go b/error_error.go new file mode 100644 index 0000000..4fd0e15 --- /dev/null +++ b/error_error.go @@ -0,0 +1,21 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type ErrorError struct { + + Message string `json:"message"` + + Detail string `json:"detail,omitempty"` + + // Optional structured data that is endpoint-specific. + Data *interface{} `json:"data,omitempty"` +} diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..ae01b18 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/group.go b/group.go new file mode 100644 index 0000000..c24987d --- /dev/null +++ b/group.go @@ -0,0 +1,31 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type Group struct { + + Type_ string `json:"type"` + + Links *GroupLinks `json:"links,omitempty"` + + Owner *Account `json:"owner,omitempty"` + + Name string `json:"name,omitempty"` + + // The \"sluggified\" version of the group's name. This contains only ASCII characters and can therefore be slightly different than the name + Slug string `json:"slug,omitempty"` + + // The concatenation of the owner's username and the group's slug, separated with a colon (e.g. `acme:developers`) + FullSlug string `json:"full_slug,omitempty"` + + // The number of members in this group + Members int32 `json:"members,omitempty"` +} diff --git a/group_links.go b/group_links.go new file mode 100644 index 0000000..58241cc --- /dev/null +++ b/group_links.go @@ -0,0 +1,18 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type GroupLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Html *MilestoneLinksSelf `json:"html,omitempty"` +} diff --git a/hook_event.go b/hook_event.go new file mode 100644 index 0000000..fbde852 --- /dev/null +++ b/hook_event.go @@ -0,0 +1,27 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// An event, associated with a resource or subject type. +type HookEvent struct { + + // The event identifier. + Event string `json:"event,omitempty"` + + // The category this event belongs to. + Category string `json:"category,omitempty"` + + // Summary of the webhook event type. + Label string `json:"label,omitempty"` + + // More detailed description of the webhook event type. + Description string `json:"description,omitempty"` +} diff --git a/issue.go b/issue.go new file mode 100644 index 0000000..f3b2a6c --- /dev/null +++ b/issue.go @@ -0,0 +1,54 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Issue struct { + + Type_ string `json:"type"` + + Links *IssueLinks `json:"links,omitempty"` + + Id int32 `json:"id,omitempty"` + + Repository *Repository `json:"repository,omitempty"` + + Title string `json:"title,omitempty"` + + Reporter *User `json:"reporter,omitempty"` + + Assignee *User `json:"assignee,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + UpdatedOn time.Time `json:"updated_on,omitempty"` + + EditedOn time.Time `json:"edited_on,omitempty"` + + State string `json:"state,omitempty"` + + Kind string `json:"kind,omitempty"` + + Priority string `json:"priority,omitempty"` + + Milestone *Milestone `json:"milestone,omitempty"` + + Version *Version `json:"version,omitempty"` + + Component *Component `json:"component,omitempty"` + + Votes int32 `json:"votes,omitempty"` + + Content *PullrequestSummary `json:"content,omitempty"` +} diff --git a/issue_attachment.go b/issue_attachment.go new file mode 100644 index 0000000..cb83bd4 --- /dev/null +++ b/issue_attachment.go @@ -0,0 +1,20 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type IssueAttachment struct { + + Type_ string `json:"type"` + + Links *MilestoneLinks `json:"links,omitempty"` + + Name string `json:"name,omitempty"` +} diff --git a/issue_change.go b/issue_change.go new file mode 100644 index 0000000..dcaacb6 --- /dev/null +++ b/issue_change.go @@ -0,0 +1,35 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +// An issue change. +type IssueChange struct { + + Type_ string `json:"type"` + + Links *IssueChangeLinks `json:"links,omitempty"` + + Name string `json:"name,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + User *User `json:"user,omitempty"` + + Issue *Issue `json:"issue,omitempty"` + + Changes *IssueChangeChanges `json:"changes,omitempty"` + + Message *PullrequestSummary `json:"message,omitempty"` +} diff --git a/issue_change_changes.go b/issue_change_changes.go new file mode 100644 index 0000000..231111f --- /dev/null +++ b/issue_change_changes.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type IssueChangeChanges struct { + + Assignee *IssueChangeChangesAssignee `json:"assignee,omitempty"` + + State *IssueChangeChangesAssignee `json:"state,omitempty"` + + Title *IssueChangeChangesAssignee `json:"title,omitempty"` + + Kind *IssueChangeChangesAssignee `json:"kind,omitempty"` + + Milestone *IssueChangeChangesAssignee `json:"milestone,omitempty"` + + Component *IssueChangeChangesAssignee `json:"component,omitempty"` + + Priority *IssueChangeChangesAssignee `json:"priority,omitempty"` + + Version *IssueChangeChangesAssignee `json:"version,omitempty"` + + Content *IssueChangeChangesAssignee `json:"content,omitempty"` +} diff --git a/issue_change_changes_assignee.go b/issue_change_changes_assignee.go new file mode 100644 index 0000000..6de8db8 --- /dev/null +++ b/issue_change_changes_assignee.go @@ -0,0 +1,18 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type IssueChangeChangesAssignee struct { + + Old string `json:"old,omitempty"` + + New string `json:"new,omitempty"` +} diff --git a/issue_change_links.go b/issue_change_links.go new file mode 100644 index 0000000..b6ae0b4 --- /dev/null +++ b/issue_change_links.go @@ -0,0 +1,18 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type IssueChangeLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Issue *MilestoneLinksSelf `json:"issue,omitempty"` +} diff --git a/issue_links.go b/issue_links.go new file mode 100644 index 0000000..1e9d983 --- /dev/null +++ b/issue_links.go @@ -0,0 +1,26 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type IssueLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Html *MilestoneLinksSelf `json:"html,omitempty"` + + Comments *MilestoneLinksSelf `json:"comments,omitempty"` + + Attachments *MilestoneLinksSelf `json:"attachments,omitempty"` + + Watch *MilestoneLinksSelf `json:"watch,omitempty"` + + Vote *MilestoneLinksSelf `json:"vote,omitempty"` +} diff --git a/issue_tracker_api.go b/issue_tracker_api.go new file mode 100644 index 0000000..cf21d86 --- /dev/null +++ b/issue_tracker_api.go @@ -0,0 +1,2137 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type IssueTrackerApiService service + + +/* IssueTrackerApiService + Returns the specified issue tracker component object. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param componentId The component's id + @return Component*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugComponentsComponentIdGet(ctx context.Context, username string, repoSlug string, componentId int32) (Component, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Component + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/components/{component_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"component_id"+"}", fmt.Sprintf("%v", componentId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the components that have been defined in the issue tracker. This resource is only available on repositories that have the issue tracker enabled. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return PaginatedComponents*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugComponentsGet(ctx context.Context, username string, repoSlug string) (PaginatedComponents, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedComponents + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/components" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the issues in the issue tracker. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return PaginatedIssues*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesGet(ctx context.Context, username string, repoSlug string) (PaginatedIssues, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedIssues + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns all attachments for this issue. This returns the files' meta data. This does not return the files' actual contents. The files are always ordered by their upload date. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue's id + @return PaginatedIssueAttachments*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsGet(ctx context.Context, username string, repoSlug string, issueId int32) (PaginatedIssueAttachments, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedIssueAttachments + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/attachments" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Deletes an attachment. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param path + @param issueId + @param repoSlug + @return */ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathDelete(ctx context.Context, username string, path string, issueId string, repoSlug 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 + "/repositories/{username}/{repo_slug}/issues/{issue_id}/attachments/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the contents of the specified file attachment. Note that this endpoint does not return a JSON response, but instead returns a redirect pointing to the actual file that in turn will return the raw contents. The redirect URL contains a one-time token that has a limited lifetime. As a result, the link should not be persisted, stored, or shared. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param path + @param issueId + @param repoSlug + @return */ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPathGet(ctx context.Context, username string, path string, issueId string, repoSlug 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 + "/repositories/{username}/{repo_slug}/issues/{issue_id}/attachments/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* IssueTrackerApiService + Upload new issue attachments. To upload files, perform a `multipart/form-data` POST containing one or more file fields. When a file is uploaded with the same name as an existing attachment, then the existing file will be replaced. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue's id + @return */ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdAttachmentsPost(ctx context.Context, username string, repoSlug string, issueId int32) ( *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/attachments" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the specified issue change object. This resource is only available on repositories that have the issue tracker enabled. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue id + @param changeId The issue change id + @return IssueChange*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdChangesChangeIdGet(ctx context.Context, username string, repoSlug string, issueId string, changeId string) (IssueChange, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload IssueChange + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/changes/{change_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"change_id"+"}", fmt.Sprintf("%v", changeId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the list of all changes that have been made to the specified issue. Changes are returned in chronological order with the oldest change first. Each time an issue is edited in the UI or through the API, an immutable change record is created. It also has a comment associated to it. ``` $ curl -s https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1/changes - | jq . { \"pagelen\": 20, \"values\": [ { \"changes\": { \"priority\": { \"new\": \"trivial\", \"old\": \"major\" }, \"assignee\": { \"new\": \"\", \"old\": \"evzijst\" }, \"kind\": { \"new\": \"enhancement\", \"old\": \"bug\" } }, \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1/changes/2\" }, \"html\": { \"href\": \"https://bitbucket.org/evzijst/dogslow/issues/1#comment-2\" } }, \"issue\": { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/issues/1\" } }, \"type\": \"issue\", \"id\": 1, \"repository\": { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/evzijst/dogslow\" }, \"html\": { \"href\": \"https://bitbucket.org/evzijst/dogslow\" }, \"avatar\": { \"href\": \"https://bitbucket.org/evzijst/dogslow/avatar/32/\" } }, \"type\": \"repository\", \"name\": \"dogslow\", \"full_name\": \"evzijst/dogslow\", \"uuid\": \"{988b17c6-1a47-4e70-84ee-854d5f012bf6}\" }, \"title\": \"Updated title\" }, \"created_on\": \"2018-03-03T00:35:28.353630+00:00\", \"user\": { \"username\": \"evzijst\", \"display_name\": \"evzijst\", \"type\": \"user\", \"uuid\": \"{aaa7972b-38af-4fb1-802d-6e3854c95778}\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\" }, \"html\": { \"href\": \"https://bitbucket.org/evzijst/\" }, \"avatar\": { \"href\": \"https://bitbucket.org/account/evzijst/avatar/32/\" } } }, \"message\": { \"raw\": \"Removed assignee, changed kind and priority.\", \"markup\": \"markdown\", \"html\": \"<p>Removed assignee, changed kind and priority.</p>\", \"type\": \"rendered\" }, \"type\": \"issue_change\", \"id\": 2 } ], \"page\": 1 } ``` Changes support [filtering and sorting](../../../meta/filtering) that can be used to search for specific changes. For instance, to see when an issue transitioned to \"resolved\": ``` $ curl -s https://api.bitbucket.org/2.0/repositories/site/master/issues/1/changes \\ -G --data-urlencode='q=changes.state.new = \"resolved\"' ``` This resource is only available on repositories that have the issue tracker enabled. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue id + @param optional (nil or map[string]interface{}) with one or more of: + @param "q" (string) Query string to narrow down the response as per [filtering and sorting](../../../meta/filtering). + @param "sort" (string) Name of a response property to sort the result by as per [filtering and sorting](../../../meta/filtering#query-sort). + @return PaginatedLogEntries*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdChangesGet(ctx context.Context, username string, repoSlug string, issueId string, localVarOptionals map[string]interface{}) (PaginatedLogEntries, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedLogEntries + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/changes" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["q"], "string", "q"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sort"], "string", "sort"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["q"].(string); localVarOk { + localVarQueryParams.Add("q", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sort"].(string); localVarOk { + localVarQueryParams.Add("sort", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Makes a change to the specified issue. For example, to change an issue's state and assignee, create a new change object that modifies these fields: ``` curl https://api.bitbucket.org/2.0/site/master/issues/1234/changes \\ -s -u evzijst -X POST -H \"Content-Type: application/json\" \\ -d '{ \"changes\": { \"assignee\": { \"new\": \"evzijst\" }, \"state\": { \"new\": 'resolved\" } } \"message\": { \"raw\": \"This is now resolved.\" } }' ``` The above example also includes a custom comment to go alongside the change. This comment will also be visible on the issue page in the UI. Note that the fields of the `changes` object are strings, not objects. This allows for immutable change log records, even after user accounts, milestones, or other objects recorded in a change entry, get renamed or deleted. The assignee field stores the username. When POSTing a new change and changing the assignee, the client should also use the username in the `changes.assignee.new` field. This call requires authentication. Private repositories or private issue trackers require the caller to authenticate with an account that has appropriate authorization. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param issueId + @param repoSlug + @param body The new issue state change. Note that the only required elements are `changes.[].new`. All other elements can be omitted from the body. + @return IssueChange*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdChangesPost(ctx context.Context, username string, issueId string, repoSlug string, body IssueChange) (IssueChange, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload IssueChange + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/changes" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the specified issue comment object. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param commentId + @param issueId + @param repoSlug + @return ModelError*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdCommentsCommentIdGet(ctx context.Context, username string, commentId string, issueId string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/comments/{comment_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"comment_id"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns all comments that were made on the specified issue. The default sorting is oldest to newest and can be overridden with the `sort` query parameter. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param issueId + @param repoSlug + @return ModelError*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdCommentsGet(ctx context.Context, username string, issueId string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/comments" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Deletes the specified issue. This requires write access to the repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param issueId + @param repoSlug + @return Issue*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdDelete(ctx context.Context, username string, issueId string, repoSlug string) (Issue, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Issue + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the specified issue. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param issueId + @param repoSlug + @return Issue*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdGet(ctx context.Context, username string, issueId string, repoSlug string) (Issue, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Issue + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Modifies the issue. ``` $ curl https://api.bitbucket.org/2.0/repostories/evzijst/dogslow/issues/123 \\ -u evzijst -s -X PUT -H 'Content-Type: application/json' \\ -d '{ \"title\": \"Updated title\", \"assignee\": { \"username\": \"evzijst\" }, \"priority\": \"minor\", \"version\": { \"name\": \"1.0\" }, \"component\": null }' ``` The example above changes the `title`, `assignee`, `priority` and the `version`. It also removes the `component` from the issue by setting the field explicitly to `null`. Any field that is not present will keep its existing value. Note that the issue tracker keeps a list of all modifications made to an issue under the `/issues/123/changes` endpoint and a PUT to this endpoint will create a new changes record. Issues can also be manipulated by POSTing directly to the issue `/changes` endpoint. This is equivalent to a PUT here, except that the client is able to provide a message that will be stored alongside the change record. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue id + @return Issue*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdPut(ctx context.Context, username string, repoSlug string, issueId string) (Issue, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Issue + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Retract your vote. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue's id + @return ModelError*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdVoteDelete(ctx context.Context, username string, repoSlug string, issueId int32) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/vote" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Check whether the authenticated user has voted for this issue. A 204 status code indicates that the user has voted, while a 404 implies they haven't. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue's id + @return ModelError*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdVoteGet(ctx context.Context, username string, repoSlug string, issueId int32) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/vote" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Vote for this issue. To cast your vote, do an empty PUT. The 204 status code indicates that the operation was successful. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue's id + @return ModelError*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdVotePut(ctx context.Context, username string, repoSlug string, issueId int32) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/vote" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Stop watching this issue. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue's id + @return ModelError*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdWatchDelete(ctx context.Context, username string, repoSlug string, issueId int32) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/watch" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Indicated whether or not the authenticated user is watching this issue. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue's id + @return ModelError*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdWatchGet(ctx context.Context, username string, repoSlug string, issueId int32) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/watch" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Start watching this issue. To start watching this issue, do an empty PUT. The 204 status code indicates that the operation was successful. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param issueId The issue's id + @return ModelError*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesIssueIdWatchPut(ctx context.Context, username string, repoSlug string, issueId int32) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues/{issue_id}/watch" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"issue_id"+"}", fmt.Sprintf("%v", issueId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Creates a new issue. This call requires authentication. Private repositories or private issue trackers require the caller to authenticate with an account that has appropriate authorisation. The authenticated user is used for the issue's `reporter` field. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param body The new issue. Note that the only required element is `title`. All other elements can be omitted from the body. + @return Issue*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugIssuesPost(ctx context.Context, username string, repoSlug string, body Issue) (Issue, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Issue + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/issues" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the milestones that have been defined in the issue tracker. This resource is only available on repositories that have the issue tracker enabled. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return PaginatedMilestones*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugMilestonesGet(ctx context.Context, username string, repoSlug string) (PaginatedMilestones, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedMilestones + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/milestones" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the specified issue tracker milestone object. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param milestoneId The milestone's id + @return Milestone*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugMilestonesMilestoneIdGet(ctx context.Context, username string, repoSlug string, milestoneId int32) (Milestone, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Milestone + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/milestones/{milestone_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"milestone_id"+"}", fmt.Sprintf("%v", milestoneId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the versions that have been defined in the issue tracker. This resource is only available on repositories that have the issue tracker enabled. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return PaginatedVersions*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugVersionsGet(ctx context.Context, username string, repoSlug string) (PaginatedVersions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedVersions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/versions" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* IssueTrackerApiService + Returns the specified issue tracker version object. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param versionId The version's id + @return Version*/ +func (a *IssueTrackerApiService) RepositoriesUsernameRepoSlugVersionsVersionIdGet(ctx context.Context, username string, repoSlug string, versionId int32) (Version, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Version + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/versions/{version_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"version_id"+"}", fmt.Sprintf("%v", versionId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/milestone.go b/milestone.go new file mode 100644 index 0000000..c4c17c8 --- /dev/null +++ b/milestone.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type Milestone struct { + + Type_ string `json:"type"` + + Links *MilestoneLinks `json:"links,omitempty"` + + Name string `json:"name,omitempty"` + + Id int32 `json:"id,omitempty"` +} diff --git a/milestone_links.go b/milestone_links.go new file mode 100644 index 0000000..cdb417a --- /dev/null +++ b/milestone_links.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type MilestoneLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` +} diff --git a/milestone_links_self.go b/milestone_links_self.go new file mode 100644 index 0000000..bd3eb96 --- /dev/null +++ b/milestone_links_self.go @@ -0,0 +1,18 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type MilestoneLinksSelf struct { + + Href string `json:"href,omitempty"` + + Name string `json:"name,omitempty"` +} diff --git a/model_error.go b/model_error.go new file mode 100644 index 0000000..8624fb0 --- /dev/null +++ b/model_error.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`. +type ModelError struct { + + Type_ string `json:"type"` + + Error_ *ErrorError `json:"error,omitempty"` +} diff --git a/object.go b/object.go new file mode 100644 index 0000000..b3eb374 --- /dev/null +++ b/object.go @@ -0,0 +1,17 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`. +type Object struct { + + Type_ string `json:"type"` +} diff --git a/page.go b/page.go new file mode 100644 index 0000000..ba04ecc --- /dev/null +++ b/page.go @@ -0,0 +1,29 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type Page struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` +} diff --git a/paginated_branchrestrictions.go b/paginated_branchrestrictions.go new file mode 100644 index 0000000..eb20b09 --- /dev/null +++ b/paginated_branchrestrictions.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of branch restriction rules. +type PaginatedBranchrestrictions struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Branchrestriction `json:"values,omitempty"` +} diff --git a/paginated_commitstatuses.go b/paginated_commitstatuses.go new file mode 100644 index 0000000..c622de0 --- /dev/null +++ b/paginated_commitstatuses.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of commit status objects. +type PaginatedCommitstatuses struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Commitstatus `json:"values,omitempty"` +} diff --git a/paginated_components.go b/paginated_components.go new file mode 100644 index 0000000..470f413 --- /dev/null +++ b/paginated_components.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of issue tracker components. +type PaginatedComponents struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Component `json:"values,omitempty"` +} diff --git a/paginated_files.go b/paginated_files.go new file mode 100644 index 0000000..155d696 --- /dev/null +++ b/paginated_files.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of commit_file objects. +type PaginatedFiles struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []CommitFile `json:"values,omitempty"` +} diff --git a/paginated_hook_events.go b/paginated_hook_events.go new file mode 100644 index 0000000..bc7e045 --- /dev/null +++ b/paginated_hook_events.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of webhook types available to subscribe on. +type PaginatedHookEvents struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []HookEvent `json:"values,omitempty"` +} diff --git a/paginated_issue_attachments.go b/paginated_issue_attachments.go new file mode 100644 index 0000000..212718f --- /dev/null +++ b/paginated_issue_attachments.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of issue attachments. +type PaginatedIssueAttachments struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []IssueAttachment `json:"values,omitempty"` +} diff --git a/paginated_issues.go b/paginated_issues.go new file mode 100644 index 0000000..78039c4 --- /dev/null +++ b/paginated_issues.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of issues. +type PaginatedIssues struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Issue `json:"values,omitempty"` +} diff --git a/paginated_log_entries.go b/paginated_log_entries.go new file mode 100644 index 0000000..9f893bb --- /dev/null +++ b/paginated_log_entries.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of issue changes. +type PaginatedLogEntries struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []IssueChange `json:"values,omitempty"` +} diff --git a/paginated_milestones.go b/paginated_milestones.go new file mode 100644 index 0000000..731f886 --- /dev/null +++ b/paginated_milestones.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of issue tracker milestones. +type PaginatedMilestones struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Milestone `json:"values,omitempty"` +} diff --git a/paginated_pipeline_known_hosts.go b/paginated_pipeline_known_hosts.go new file mode 100644 index 0000000..4d5f274 --- /dev/null +++ b/paginated_pipeline_known_hosts.go @@ -0,0 +1,33 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paged list of known hosts. +type PaginatedPipelineKnownHosts struct { + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // The values of the current page. + Values []PipelineKnownHost `json:"values,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` +} diff --git a/paginated_pipeline_schedule_executions.go b/paginated_pipeline_schedule_executions.go new file mode 100644 index 0000000..15e4101 --- /dev/null +++ b/paginated_pipeline_schedule_executions.go @@ -0,0 +1,33 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paged list of the executions of a schedule. +type PaginatedPipelineScheduleExecutions struct { + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // The values of the current page. + Values []PipelineScheduleExecution `json:"values,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` +} diff --git a/paginated_pipeline_schedules.go b/paginated_pipeline_schedules.go new file mode 100644 index 0000000..c17e478 --- /dev/null +++ b/paginated_pipeline_schedules.go @@ -0,0 +1,33 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paged list of schedules +type PaginatedPipelineSchedules struct { + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // The values of the current page. + Values []PipelineSchedule `json:"values,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` +} diff --git a/paginated_pipeline_steps.go b/paginated_pipeline_steps.go new file mode 100644 index 0000000..ba4f97c --- /dev/null +++ b/paginated_pipeline_steps.go @@ -0,0 +1,33 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paged list of pipeline steps. +type PaginatedPipelineSteps struct { + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // The values of the current page. + Values []PipelineStep `json:"values,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` +} diff --git a/paginated_pipeline_variables.go b/paginated_pipeline_variables.go new file mode 100644 index 0000000..12d762b --- /dev/null +++ b/paginated_pipeline_variables.go @@ -0,0 +1,33 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paged list of variables. +type PaginatedPipelineVariables struct { + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // The values of the current page. + Values []PipelineVariable `json:"values,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` +} diff --git a/paginated_pipelines.go b/paginated_pipelines.go new file mode 100644 index 0000000..c9ade64 --- /dev/null +++ b/paginated_pipelines.go @@ -0,0 +1,33 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paged list of pipelines +type PaginatedPipelines struct { + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // The values of the current page. + Values []Pipeline `json:"values,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` +} diff --git a/paginated_projects.go b/paginated_projects.go new file mode 100644 index 0000000..4fdb5f1 --- /dev/null +++ b/paginated_projects.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of projects +type PaginatedProjects struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Project `json:"values,omitempty"` +} diff --git a/paginated_pullrequest_comments.go b/paginated_pullrequest_comments.go new file mode 100644 index 0000000..ed1a52d --- /dev/null +++ b/paginated_pullrequest_comments.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of pullrequest comments. +type PaginatedPullrequestComments struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []PullrequestComment `json:"values,omitempty"` +} diff --git a/paginated_pullrequests.go b/paginated_pullrequests.go new file mode 100644 index 0000000..255ef47 --- /dev/null +++ b/paginated_pullrequests.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of pullrequests. +type PaginatedPullrequests struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Pullrequest `json:"values,omitempty"` +} diff --git a/paginated_repositories.go b/paginated_repositories.go new file mode 100644 index 0000000..e946db0 --- /dev/null +++ b/paginated_repositories.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of repositories. +type PaginatedRepositories struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Repository `json:"values,omitempty"` +} diff --git a/paginated_repository_permissions.go b/paginated_repository_permissions.go new file mode 100644 index 0000000..66a0704 --- /dev/null +++ b/paginated_repository_permissions.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of repository permissions. +type PaginatedRepositoryPermissions struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []RepositoryPermission `json:"values,omitempty"` +} diff --git a/paginated_snippet_comments.go b/paginated_snippet_comments.go new file mode 100644 index 0000000..ab41410 --- /dev/null +++ b/paginated_snippet_comments.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of snippet comments. +type PaginatedSnippetComments struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []SnippetComment `json:"values,omitempty"` +} diff --git a/paginated_snippet_commit.go b/paginated_snippet_commit.go new file mode 100644 index 0000000..64cbd86 --- /dev/null +++ b/paginated_snippet_commit.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of snippet commits. +type PaginatedSnippetCommit struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []SnippetCommit `json:"values,omitempty"` +} diff --git a/paginated_snippets.go b/paginated_snippets.go new file mode 100644 index 0000000..f67f115 --- /dev/null +++ b/paginated_snippets.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of snippets. +type PaginatedSnippets struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Snippet `json:"values,omitempty"` +} diff --git a/paginated_ssh_user_keys.go b/paginated_ssh_user_keys.go new file mode 100644 index 0000000..325a8d9 --- /dev/null +++ b/paginated_ssh_user_keys.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of SSH keys. +type PaginatedSshUserKeys struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []SshAccountKey `json:"values,omitempty"` +} diff --git a/paginated_team_permissions.go b/paginated_team_permissions.go new file mode 100644 index 0000000..b1aa991 --- /dev/null +++ b/paginated_team_permissions.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of team permissions. +type PaginatedTeamPermissions struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []TeamPermission `json:"values,omitempty"` +} diff --git a/paginated_teams.go b/paginated_teams.go new file mode 100644 index 0000000..49d7d25 --- /dev/null +++ b/paginated_teams.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of teams. +type PaginatedTeams struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Team `json:"values,omitempty"` +} diff --git a/paginated_treeentries.go b/paginated_treeentries.go new file mode 100644 index 0000000..28fc94f --- /dev/null +++ b/paginated_treeentries.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of commit_file and/or commit_directory objects. +type PaginatedTreeentries struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Treeentry `json:"values,omitempty"` +} diff --git a/paginated_users.go b/paginated_users.go new file mode 100644 index 0000000..b943a93 --- /dev/null +++ b/paginated_users.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of users. +type PaginatedUsers struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []User `json:"values,omitempty"` +} diff --git a/paginated_versions.go b/paginated_versions.go new file mode 100644 index 0000000..58ae514 --- /dev/null +++ b/paginated_versions.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of issue tracker versions. +type PaginatedVersions struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []Version `json:"values,omitempty"` +} diff --git a/paginated_webhook_subscriptions.go b/paginated_webhook_subscriptions.go new file mode 100644 index 0000000..3cbba93 --- /dev/null +++ b/paginated_webhook_subscriptions.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A paginated list of webhook subscriptions +type PaginatedWebhookSubscriptions struct { + + // Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute. + Size int32 `json:"size,omitempty"` + + // Page number of the current results. This is an optional element that is not provided in all responses. + Page int32 `json:"page,omitempty"` + + // Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values. + Pagelen int32 `json:"pagelen,omitempty"` + + // Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs. + Next string `json:"next,omitempty"` + + // Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs. + Previous string `json:"previous,omitempty"` + + Values []WebhookSubscription `json:"values,omitempty"` +} diff --git a/participant.go b/participant.go new file mode 100644 index 0000000..b47fbaa --- /dev/null +++ b/participant.go @@ -0,0 +1,29 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Participant struct { + + Type_ string `json:"type"` + + User *User `json:"user,omitempty"` + + Role string `json:"role,omitempty"` + + Approved bool `json:"approved,omitempty"` + + // The ISO8601 timestamp of the participant's action. For approvers, this is the time of their approval. For commenters and pull request reviewers who are not approvers, this is the time they last commented, or null if they have not commented. + ParticipatedOn time.Time `json:"participated_on,omitempty"` +} diff --git a/pipeline.go b/pipeline.go new file mode 100644 index 0000000..7c42d09 --- /dev/null +++ b/pipeline.go @@ -0,0 +1,48 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Pipeline struct { + + Type_ string `json:"type"` + + // The build number of the pipeline. + BuildNumber int32 `json:"build_number,omitempty"` + + // The target that the pipeline built. + Target *PipelineTarget `json:"target,omitempty"` + + Repository *Repository `json:"repository,omitempty"` + + // The Bitbucket account that was used to create the pipeline. + Creator *Account `json:"creator,omitempty"` + + // The timestamp when the pipeline was created. + CreatedOn time.Time `json:"created_on,omitempty"` + + State *PipelineState `json:"state,omitempty"` + + // The trigger used for the pipeline. + Trigger *PipelineTrigger `json:"trigger,omitempty"` + + // The number of build seconds used by this pipeline. + BuildSecondsUsed int32 `json:"build_seconds_used,omitempty"` + + // The timestamp when the Pipeline was completed. This is not set if the pipeline is still in progress. + CompletedOn time.Time `json:"completed_on,omitempty"` + + // The UUID identifying the pipeline. + Uuid string `json:"uuid,omitempty"` +} diff --git a/pipeline_build_number.go b/pipeline_build_number.go new file mode 100644 index 0000000..bdea380 --- /dev/null +++ b/pipeline_build_number.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineBuildNumber struct { + + Type_ string `json:"type"` + + // The next number that will be used as build number. + Next int32 `json:"next,omitempty"` +} diff --git a/pipeline_command.go b/pipeline_command.go new file mode 100644 index 0000000..10d8f5f --- /dev/null +++ b/pipeline_command.go @@ -0,0 +1,24 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// An executable pipeline command. +type PipelineCommand struct { + + // The executable command. + Command string `json:"command,omitempty"` + + // The name of the command. + Name string `json:"name,omitempty"` + + // The range in the log that contains the execution output of this command. + LogRange *PipelineLogRange `json:"log_range,omitempty"` +} diff --git a/pipeline_commit_target.go b/pipeline_commit_target.go new file mode 100644 index 0000000..57ce640 --- /dev/null +++ b/pipeline_commit_target.go @@ -0,0 +1,20 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineCommitTarget struct { + + Type_ string `json:"type"` + + Commit *Commit `json:"commit,omitempty"` + + Selector *PipelineSelector `json:"selector,omitempty"` +} diff --git a/pipeline_error.go b/pipeline_error.go new file mode 100644 index 0000000..b8454bf --- /dev/null +++ b/pipeline_error.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineError struct { + + Type_ string `json:"type"` + + // The error message. + Message string `json:"message,omitempty"` + + // The error key. + Key string `json:"key,omitempty"` +} diff --git a/pipeline_image.go b/pipeline_image.go new file mode 100644 index 0000000..70799f7 --- /dev/null +++ b/pipeline_image.go @@ -0,0 +1,27 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// The definition of a Docker image that can be used for a Bitbucket Pipelines step execution context. +type PipelineImage struct { + + // The username needed to authenticate with the Docker registry. Only required when using a private Docker image. + Username string `json:"username,omitempty"` + + // The password needed to authenticate with the Docker registry. Only required when using a private Docker image. + Password string `json:"password,omitempty"` + + // The name of the image. If the image is hosted on DockerHub the short name can be used, otherwise the fully qualified name is required here. + Name string `json:"name,omitempty"` + + // The email needed to authenticate with the Docker registry. Only required when using a private Docker image. + Email string `json:"email,omitempty"` +} diff --git a/pipeline_known_host.go b/pipeline_known_host.go new file mode 100644 index 0000000..337b1cf --- /dev/null +++ b/pipeline_known_host.go @@ -0,0 +1,25 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineKnownHost struct { + + Type_ string `json:"type"` + + // The public key of the known host. + PublicKey *PipelineSshPublicKey `json:"public_key,omitempty"` + + // The hostname of the known host. + Hostname string `json:"hostname,omitempty"` + + // The UUID identifying the known host. + Uuid string `json:"uuid,omitempty"` +} diff --git a/pipeline_log_range.go b/pipeline_log_range.go new file mode 100644 index 0000000..82faeea --- /dev/null +++ b/pipeline_log_range.go @@ -0,0 +1,21 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A reference to a range of bytes in a log file (does not contain the actual bytes). +type PipelineLogRange struct { + + // The position of the last byte of the range in the log. + LastBytePosition int32 `json:"last_byte_position,omitempty"` + + // The position of the first byte of the range in the log. + FirstBytePosition int32 `json:"first_byte_position,omitempty"` +} diff --git a/pipeline_ref_target.go b/pipeline_ref_target.go new file mode 100644 index 0000000..e5fdc01 --- /dev/null +++ b/pipeline_ref_target.go @@ -0,0 +1,26 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineRefTarget struct { + + Type_ string `json:"type"` + + Commit *Commit `json:"commit,omitempty"` + + // The type of reference (branch/tag). + RefType string `json:"ref_type,omitempty"` + + Selector *PipelineSelector `json:"selector,omitempty"` + + // The name of the reference. + RefName string `json:"ref_name,omitempty"` +} diff --git a/pipeline_schedule.go b/pipeline_schedule.go new file mode 100644 index 0000000..71eea12 --- /dev/null +++ b/pipeline_schedule.go @@ -0,0 +1,40 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type PipelineSchedule struct { + + Type_ string `json:"type"` + + // The UUID identifying the schedule. + Uuid string `json:"uuid,omitempty"` + + // The cron expression that the schedule applies. + CronPattern string `json:"cron_pattern,omitempty"` + + // Whether the schedule is enabled. + Enabled bool `json:"enabled,omitempty"` + + Selector *PipelineSelector `json:"selector,omitempty"` + + // The timestamp when the schedule was created. + CreatedOn time.Time `json:"created_on,omitempty"` + + // The timestamp when the schedule was updated. + UpdatedOn time.Time `json:"updated_on,omitempty"` + + // The target on which the schedule will be executed. + Target *PipelineTarget `json:"target,omitempty"` +} diff --git a/pipeline_schedule_execution.go b/pipeline_schedule_execution.go new file mode 100644 index 0000000..222c16c --- /dev/null +++ b/pipeline_schedule_execution.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineScheduleExecution struct { + + Type_ string `json:"type"` +} diff --git a/pipeline_schedule_execution_errored.go b/pipeline_schedule_execution_errored.go new file mode 100644 index 0000000..a10e57c --- /dev/null +++ b/pipeline_schedule_execution_errored.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineScheduleExecutionErrored struct { + + Type_ string `json:"type"` + + // The error that caused the execution to fail. + Error_ *PipelineError `json:"error,omitempty"` +} diff --git a/pipeline_schedule_execution_executed.go b/pipeline_schedule_execution_executed.go new file mode 100644 index 0000000..923609f --- /dev/null +++ b/pipeline_schedule_execution_executed.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineScheduleExecutionExecuted struct { + + Type_ string `json:"type"` + + // The pipeline that was triggered by this execution of a schedule. + Pipeline *Pipeline `json:"pipeline,omitempty"` +} diff --git a/pipeline_selector.go b/pipeline_selector.go new file mode 100644 index 0000000..6db29af --- /dev/null +++ b/pipeline_selector.go @@ -0,0 +1,20 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineSelector struct { + + // The type of selector. + Type_ string `json:"type"` + + // The name of the matching pipeline definition. + Pattern string `json:"pattern,omitempty"` +} diff --git a/pipeline_ssh_key_pair.go b/pipeline_ssh_key_pair.go new file mode 100644 index 0000000..efff335 --- /dev/null +++ b/pipeline_ssh_key_pair.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineSshKeyPair struct { + + Type_ string `json:"type"` + + // The SSH public key. + PublicKey string `json:"public_key,omitempty"` + + // The SSH private key. This value will be empty when retrieving the SSH key pair. + PrivateKey string `json:"private_key,omitempty"` +} diff --git a/pipeline_ssh_public_key.go b/pipeline_ssh_public_key.go new file mode 100644 index 0000000..8ea1d27 --- /dev/null +++ b/pipeline_ssh_public_key.go @@ -0,0 +1,28 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineSshPublicKey struct { + + Type_ string `json:"type"` + + // The type of the public key. + KeyType string `json:"key_type,omitempty"` + + // The MD5 fingerprint of the public key. + Md5Fingerprint string `json:"md5_fingerprint,omitempty"` + + // The SHA-256 fingerprint of the public key. + Sha256Fingerprint string `json:"sha256_fingerprint,omitempty"` + + // The base64 encoded public key. + Key string `json:"key,omitempty"` +} diff --git a/pipeline_state.go b/pipeline_state.go new file mode 100644 index 0000000..2c9ec0e --- /dev/null +++ b/pipeline_state.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineState struct { + + Type_ string `json:"type"` +} diff --git a/pipeline_state_completed.go b/pipeline_state_completed.go new file mode 100644 index 0000000..6b3ec0b --- /dev/null +++ b/pipeline_state_completed.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateCompleted struct { + + Type_ string `json:"type"` + + // The name of pipeline state (COMPLETED). + Name string `json:"name,omitempty"` + + // A result of a completed state of a pipeline. + Result *PipelineStateCompletedResult `json:"result,omitempty"` +} diff --git a/pipeline_state_completed_error.go b/pipeline_state_completed_error.go new file mode 100644 index 0000000..7fad953 --- /dev/null +++ b/pipeline_state_completed_error.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateCompletedError struct { + + Type_ string `json:"type"` + + // The name of the result (ERROR) + Name string `json:"name,omitempty"` + + // An error result of a completed state of a Bitbucket Pipeline. + Error_ *PipelineError `json:"error,omitempty"` +} diff --git a/pipeline_state_completed_expired.go b/pipeline_state_completed_expired.go new file mode 100644 index 0000000..ba1e58c --- /dev/null +++ b/pipeline_state_completed_expired.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateCompletedExpired struct { + + Type_ string `json:"type"` + + // The name of the stopped result (EXPIRED). + Name string `json:"name,omitempty"` +} diff --git a/pipeline_state_completed_failed.go b/pipeline_state_completed_failed.go new file mode 100644 index 0000000..82e689f --- /dev/null +++ b/pipeline_state_completed_failed.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateCompletedFailed struct { + + Type_ string `json:"type"` + + // The name of the failed result (FAILED). + Name string `json:"name,omitempty"` +} diff --git a/pipeline_state_completed_result.go b/pipeline_state_completed_result.go new file mode 100644 index 0000000..993f3d3 --- /dev/null +++ b/pipeline_state_completed_result.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateCompletedResult struct { + + Type_ string `json:"type"` +} diff --git a/pipeline_state_completed_stopped.go b/pipeline_state_completed_stopped.go new file mode 100644 index 0000000..17533a7 --- /dev/null +++ b/pipeline_state_completed_stopped.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateCompletedStopped struct { + + Type_ string `json:"type"` + + // The name of the stopped result (STOPPED). + Name string `json:"name,omitempty"` +} diff --git a/pipeline_state_completed_successful.go b/pipeline_state_completed_successful.go new file mode 100644 index 0000000..018c08a --- /dev/null +++ b/pipeline_state_completed_successful.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateCompletedSuccessful struct { + + Type_ string `json:"type"` + + // The name of the successful result (SUCCESSFUL). + Name string `json:"name,omitempty"` +} diff --git a/pipeline_state_in_progress.go b/pipeline_state_in_progress.go new file mode 100644 index 0000000..3b15dd8 --- /dev/null +++ b/pipeline_state_in_progress.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateInProgress struct { + + Type_ string `json:"type"` + + // The name of pipeline state (IN_PROGRESS). + Name string `json:"name,omitempty"` + + // A stage of an in progress state of a pipeline. + Stage *PipelineStateInProgressStage `json:"stage,omitempty"` +} diff --git a/pipeline_state_in_progress_paused.go b/pipeline_state_in_progress_paused.go new file mode 100644 index 0000000..b687323 --- /dev/null +++ b/pipeline_state_in_progress_paused.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateInProgressPaused struct { + + Type_ string `json:"type"` + + // The name of the stage (PAUSED) + Name string `json:"name,omitempty"` +} diff --git a/pipeline_state_in_progress_running.go b/pipeline_state_in_progress_running.go new file mode 100644 index 0000000..ecb9d55 --- /dev/null +++ b/pipeline_state_in_progress_running.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateInProgressRunning struct { + + Type_ string `json:"type"` + + // The name of the stage (RUNNING) + Name string `json:"name,omitempty"` +} diff --git a/pipeline_state_in_progress_stage.go b/pipeline_state_in_progress_stage.go new file mode 100644 index 0000000..8907ce7 --- /dev/null +++ b/pipeline_state_in_progress_stage.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStateInProgressStage struct { + + Type_ string `json:"type"` +} diff --git a/pipeline_state_pending.go b/pipeline_state_pending.go new file mode 100644 index 0000000..5c36f12 --- /dev/null +++ b/pipeline_state_pending.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStatePending struct { + + Type_ string `json:"type"` + + // The name of pipeline state (PENDING). + Name string `json:"name,omitempty"` +} diff --git a/pipeline_step.go b/pipeline_step.go new file mode 100644 index 0000000..eb377ba --- /dev/null +++ b/pipeline_step.go @@ -0,0 +1,44 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type PipelineStep struct { + + Type_ string `json:"type"` + + // The timestamp when the step execution was completed. This is not set if the step is still in progress. + CompletedOn time.Time `json:"completed_on,omitempty"` + + // The amount of bytes of the log file that is available. + LogByteCount int32 `json:"logByteCount,omitempty"` + + // The Docker image used as the build container for the step. + Image *PipelineImage `json:"image,omitempty"` + + // The timestamp when the step execution was started. This is not set when the step hasn't executed yet. + StartedOn time.Time `json:"started_on,omitempty"` + + // The list of build commands. These commands are executed in the build container. + ScriptCommands []PipelineCommand `json:"script_commands,omitempty"` + + // The current state of the step + State *PipelineStepState `json:"state,omitempty"` + + // The list of commands that are executed as part of the setup phase of the build. These commands are executed outside the build container. + SetupCommands []PipelineCommand `json:"setup_commands,omitempty"` + + // The UUID identifying the step. + Uuid string `json:"uuid,omitempty"` +} diff --git a/pipeline_step_error.go b/pipeline_step_error.go new file mode 100644 index 0000000..da53a72 --- /dev/null +++ b/pipeline_step_error.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepError struct { + + Type_ string `json:"type"` + + // The error message. + Message string `json:"message,omitempty"` + + // The error key. + Key string `json:"key,omitempty"` +} diff --git a/pipeline_step_state.go b/pipeline_step_state.go new file mode 100644 index 0000000..5598294 --- /dev/null +++ b/pipeline_step_state.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepState struct { + + Type_ string `json:"type"` +} diff --git a/pipeline_step_state_completed.go b/pipeline_step_state_completed.go new file mode 100644 index 0000000..dde6f85 --- /dev/null +++ b/pipeline_step_state_completed.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStateCompleted struct { + + Type_ string `json:"type"` + + // The name of pipeline step state (COMPLETED). + Name string `json:"name,omitempty"` + + // A result of a completed state of a pipeline step. + Result *PipelineStepStateCompletedResult `json:"result,omitempty"` +} diff --git a/pipeline_step_state_completed_error.go b/pipeline_step_state_completed_error.go new file mode 100644 index 0000000..6505664 --- /dev/null +++ b/pipeline_step_state_completed_error.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStateCompletedError struct { + + Type_ string `json:"type"` + + // The name of the result (ERROR) + Name string `json:"name,omitempty"` + + // An error result of a completed state of a Bitbucket Pipeline step. + Error_ *PipelineStepError `json:"error,omitempty"` +} diff --git a/pipeline_step_state_completed_expired.go b/pipeline_step_state_completed_expired.go new file mode 100644 index 0000000..ad63d41 --- /dev/null +++ b/pipeline_step_state_completed_expired.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStateCompletedExpired struct { + + Type_ string `json:"type"` + + // The name of the result (EXPIRED) + Name string `json:"name,omitempty"` +} diff --git a/pipeline_step_state_completed_failed.go b/pipeline_step_state_completed_failed.go new file mode 100644 index 0000000..8a8742a --- /dev/null +++ b/pipeline_step_state_completed_failed.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStateCompletedFailed struct { + + Type_ string `json:"type"` + + // The name of the result (FAILED) + Name string `json:"name,omitempty"` +} diff --git a/pipeline_step_state_completed_not_run.go b/pipeline_step_state_completed_not_run.go new file mode 100644 index 0000000..ceecc70 --- /dev/null +++ b/pipeline_step_state_completed_not_run.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStateCompletedNotRun struct { + + Type_ string `json:"type"` + + // The name of the result (NOT_RUN) + Name string `json:"name,omitempty"` +} diff --git a/pipeline_step_state_completed_result.go b/pipeline_step_state_completed_result.go new file mode 100644 index 0000000..85a2139 --- /dev/null +++ b/pipeline_step_state_completed_result.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStateCompletedResult struct { + + Type_ string `json:"type"` +} diff --git a/pipeline_step_state_completed_stopped.go b/pipeline_step_state_completed_stopped.go new file mode 100644 index 0000000..159b966 --- /dev/null +++ b/pipeline_step_state_completed_stopped.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStateCompletedStopped struct { + + Type_ string `json:"type"` + + // The name of the result (STOPPED) + Name string `json:"name,omitempty"` +} diff --git a/pipeline_step_state_completed_successful.go b/pipeline_step_state_completed_successful.go new file mode 100644 index 0000000..23bfdf0 --- /dev/null +++ b/pipeline_step_state_completed_successful.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStateCompletedSuccessful struct { + + Type_ string `json:"type"` + + // The name of the result (SUCCESSFUL) + Name string `json:"name,omitempty"` +} diff --git a/pipeline_step_state_in_progress.go b/pipeline_step_state_in_progress.go new file mode 100644 index 0000000..db9c5b7 --- /dev/null +++ b/pipeline_step_state_in_progress.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStateInProgress struct { + + Type_ string `json:"type"` + + // The name of pipeline step state (IN_PROGRESS). + Name string `json:"name,omitempty"` +} diff --git a/pipeline_step_state_pending.go b/pipeline_step_state_pending.go new file mode 100644 index 0000000..775303c --- /dev/null +++ b/pipeline_step_state_pending.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStatePending struct { + + Type_ string `json:"type"` + + // The name of pipeline step state (PENDING). + Name string `json:"name,omitempty"` +} diff --git a/pipeline_step_state_ready.go b/pipeline_step_state_ready.go new file mode 100644 index 0000000..9230755 --- /dev/null +++ b/pipeline_step_state_ready.go @@ -0,0 +1,19 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineStepStateReady struct { + + Type_ string `json:"type"` + + // The name of pipeline step state (READY). + Name string `json:"name,omitempty"` +} diff --git a/pipeline_target.go b/pipeline_target.go new file mode 100644 index 0000000..d827dc3 --- /dev/null +++ b/pipeline_target.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineTarget struct { + + Type_ string `json:"type"` +} diff --git a/pipeline_trigger.go b/pipeline_trigger.go new file mode 100644 index 0000000..aabac71 --- /dev/null +++ b/pipeline_trigger.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineTrigger struct { + + Type_ string `json:"type"` +} diff --git a/pipeline_trigger_manual.go b/pipeline_trigger_manual.go new file mode 100644 index 0000000..f9184d5 --- /dev/null +++ b/pipeline_trigger_manual.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineTriggerManual struct { + + Type_ string `json:"type"` +} diff --git a/pipeline_trigger_push.go b/pipeline_trigger_push.go new file mode 100644 index 0000000..b6d4185 --- /dev/null +++ b/pipeline_trigger_push.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineTriggerPush struct { + + Type_ string `json:"type"` +} diff --git a/pipeline_variable.go b/pipeline_variable.go new file mode 100644 index 0000000..c2ff1b8 --- /dev/null +++ b/pipeline_variable.go @@ -0,0 +1,28 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelineVariable struct { + + Type_ string `json:"type"` + + // The value of the variable. If the variable is secured, this will be empty. + Value string `json:"value,omitempty"` + + // If true, this variable will be treated as secured. The value will never be exposed in the logs or the REST API. + Secured bool `json:"secured,omitempty"` + + // The UUID identifying the variable. + Uuid string `json:"uuid,omitempty"` + + // The unique name of the variable. + Key string `json:"key,omitempty"` +} diff --git a/pipelines_api.go b/pipelines_api.go new file mode 100644 index 0000000..e73377e --- /dev/null +++ b/pipelines_api.go @@ -0,0 +1,2667 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type PipelinesApiService service + + +/* PipelinesApiService + Endpoint to create and initiate a pipeline. There are a couple of different options to initiate a pipeline, where the payload of the request will determine which type of pipeline will be instantiated. # Trigger a Pipeline for a branch or tag One way to trigger pipelines is by specifying the reference for which you want to trigger a pipeline (e.g. a branch or tag). The specified reference will be used to determine which pipeline definition from the `bitbucket-pipelines.yml` file will be applied to initiate the pipeline. The pipeline will then do a clone of the repository and checkout the latest revision of the specified reference. ### Example ``` $ curl -X POST -is -u username:password \\ -H 'Content-Type: application/json' \\ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \\ -d ' { \"target\": { \"ref_type\": \"branch\", \"type\": \"pipeline_ref_target\", \"ref_name\": \"master\" } }' ``` # Trigger a Pipeline for a commit on a branch or tag You can initiate a pipeline for a specific commit and in the context of a specified reference (e.g. a branch, tag or bookmark). The specified reference will be used to determine which pipeline definition from the bitbucket-pipelines.yml file will be applied to initiate the pipeline. The pipeline will clone the repository and then do a checkout the specified reference. The following reference types are supported: * `branch` * `named_branch` * `bookmark` * `tag` ### Example ``` $ curl -X POST -is -u username:password \\ -H 'Content-Type: application/json' \\ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \\ -d ' { \"target\": { \"commit\": { \"type\": \"commit\", \"hash\": \"ce5b7431602f7cbba007062eeb55225c6e18e956\" }, \"ref_type\": \"branch\", \"type\": \"pipeline_ref_target\", \"ref_name\": \"master\" } }' ``` # Trigger a specific pipeline definition for a commit You can trigger a specific pipeline that is defined in your `bitbucket-pipelines.yml` file for a specific commit. In addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition. The resulting pipeline will then clone the repository and checkout the specified revision. ### Example ``` $ curl -X POST -is -u username:password \\ -H 'Content-Type: application/json' \\ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \\ -d ' { \"target\": { \"commit\": { \"hash\":\"a3c4e02c9a3755eccdc3764e6ea13facdf30f923\", \"type\":\"commit\" }, \"selector\": { \"type\":\"custom\", \"pattern\":\"Deploy to production\" }, \"type\":\"pipeline_commit_target\" } }' ``` # Trigger a specific pipeline definition for a commit on a branch or tag You can trigger a specific pipeline that is defined in your `bitbucket-pipelines.yml` file for a specific commit in the context of a specified reference. In addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition, as well as the reference information. The resulting pipeline will then clone the repository a checkout the specified reference. ### Example ``` $ curl -X POST -is -u username:password \\ -H 'Content-Type: application/json' \\ https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/pipelines/ \\ -d ' { \"target\": { \"commit\": { \"hash\":\"a3c4e02c9a3755eccdc3764e6ea13facdf30f923\", \"type\":\"commit\" }, \"selector\": { \"type\": \"custom\", \"pattern\": \"Deploy to production\" }, \"type\": \"pipeline_ref_target\", \"ref_name\": \"master\", \"ref_type\": \"branch\" } }' ``` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param body The pipeline to initiate. + @return Pipeline*/ +func (a *PipelinesApiService) CreatePipelineForRepository(ctx context.Context, username string, repoSlug string, body Pipeline) (Pipeline, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Pipeline + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Create an account level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (PipelineVariable) The variable to create. + @return PipelineVariable*/ +func (a *PipelinesApiService) CreatePipelineVariableForTeam(ctx context.Context, username string, localVarOptionals map[string]interface{}) (PipelineVariable, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineVariable + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/pipelines_config/variables/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(PipelineVariable); localVarOk { + localVarPostBody = &localVarTempParam + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Create a user level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (PipelineVariable) The variable to create. + @return PipelineVariable*/ +func (a *PipelinesApiService) CreatePipelineVariableForUser(ctx context.Context, username string, localVarOptionals map[string]interface{}) (PipelineVariable, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineVariable + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/pipelines_config/variables/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(PipelineVariable); localVarOk { + localVarPostBody = &localVarTempParam + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Create a repository level known host. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param body The known host to create. + @return PipelineKnownHost*/ +func (a *PipelinesApiService) CreateRepositoryPipelineKnownHost(ctx context.Context, username string, repoSlug string, body PipelineKnownHost) (PipelineKnownHost, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineKnownHost + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Create a schedule for the given repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param body The schedule to create. + @return PipelineSchedule*/ +func (a *PipelinesApiService) CreateRepositoryPipelineSchedule(ctx context.Context, username string, repoSlug string, body PipelineSchedule) (PipelineSchedule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineSchedule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/schedules/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Create a repository level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param body The variable to create. + @return PipelineVariable*/ +func (a *PipelinesApiService) CreateRepositoryPipelineVariable(ctx context.Context, username string, repoSlug string, body PipelineVariable) (PipelineVariable, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineVariable + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/variables/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Delete a team level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param variableUuid The UUID of the variable to delete. + @return */ +func (a *PipelinesApiService) DeletePipelineVariableForTeam(ctx context.Context, username string, variableUuid 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 + "/teams/{username}/pipelines_config/variables/{variable_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"variable_uuid"+"}", fmt.Sprintf("%v", variableUuid), -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 + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PipelinesApiService + Delete an account level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param variableUuid The UUID of the variable to delete. + @return */ +func (a *PipelinesApiService) DeletePipelineVariableForUser(ctx context.Context, username string, variableUuid 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 + "/users/{username}/pipelines_config/variables/{variable_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"variable_uuid"+"}", fmt.Sprintf("%v", variableUuid), -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 + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PipelinesApiService + Delete the repository SSH key pair. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @return */ +func (a *PipelinesApiService) DeleteRepositoryPipelineKeyPair(ctx context.Context, username string, repoSlug 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 + "/repositories/{username}/{repo_slug}/pipelines_config/ssh/key_pair" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PipelinesApiService + Delete a repository level known host. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param knownHostUuid The UUID of the known host to delete. + @return */ +func (a *PipelinesApiService) DeleteRepositoryPipelineKnownHost(ctx context.Context, username string, repoSlug string, knownHostUuid 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 + "/repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"known_host_uuid"+"}", fmt.Sprintf("%v", knownHostUuid), -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 + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PipelinesApiService + Delete a schedule. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param scheduleUuid The uuid of the schedule. + @return */ +func (a *PipelinesApiService) DeleteRepositoryPipelineSchedule(ctx context.Context, username string, repoSlug string, scheduleUuid 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 + "/repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"schedule_uuid"+"}", fmt.Sprintf("%v", scheduleUuid), -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 + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PipelinesApiService + Delete a repository level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param variableUuid The UUID of the variable to delete. + @return */ +func (a *PipelinesApiService) DeleteRepositoryPipelineVariable(ctx context.Context, username string, repoSlug string, variableUuid 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 + "/repositories/{username}/{repo_slug}/pipelines_config/variables/{variable_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"variable_uuid"+"}", fmt.Sprintf("%v", variableUuid), -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 + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve a specified pipeline + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param pipelineUuid The pipeline UUID. + @return Pipeline*/ +func (a *PipelinesApiService) GetPipelineForRepository(ctx context.Context, username string, repoSlug string, pipelineUuid string) (Pipeline, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Pipeline + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pipeline_uuid"+"}", fmt.Sprintf("%v", pipelineUuid), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve a given step of a pipeline. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param pipelineUuid The UUID of the pipeline. + @param stepUuid The UUID of the step. + @return PipelineStep*/ +func (a *PipelinesApiService) GetPipelineStepForRepository(ctx context.Context, username string, repoSlug string, pipelineUuid string, stepUuid string) (PipelineStep, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineStep + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pipeline_uuid"+"}", fmt.Sprintf("%v", pipelineUuid), -1) + localVarPath = strings.Replace(localVarPath, "{"+"step_uuid"+"}", fmt.Sprintf("%v", stepUuid), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve the log file for a given step of a pipeline. This endpoint supports (and encourages!) the use of [HTTP Range requests](https://tools.ietf.org/html/rfc7233) to deal with potentially very large log files. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param pipelineUuid The UUID of the pipeline. + @param stepUuid The UUID of the step. + @return */ +func (a *PipelinesApiService) GetPipelineStepLogForRepository(ctx context.Context, username string, repoSlug string, pipelineUuid string, stepUuid 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 + "/repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/log" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pipeline_uuid"+"}", fmt.Sprintf("%v", pipelineUuid), -1) + localVarPath = strings.Replace(localVarPath, "{"+"step_uuid"+"}", fmt.Sprintf("%v", stepUuid), -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/octet-stream", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PipelinesApiService + Find steps for the given pipeline. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param pipelineUuid The UUID of the pipeline. + @return PaginatedPipelineSteps*/ +func (a *PipelinesApiService) GetPipelineStepsForRepository(ctx context.Context, username string, repoSlug string, pipelineUuid string) (PaginatedPipelineSteps, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedPipelineSteps + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/steps/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pipeline_uuid"+"}", fmt.Sprintf("%v", pipelineUuid), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve a team level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param variableUuid The UUID of the variable to retrieve. + @return PipelineVariable*/ +func (a *PipelinesApiService) GetPipelineVariableForTeam(ctx context.Context, username string, variableUuid string) (PipelineVariable, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineVariable + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/pipelines_config/variables/{variable_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"variable_uuid"+"}", fmt.Sprintf("%v", variableUuid), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve a user level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param variableUuid The UUID of the variable to retrieve. + @return PipelineVariable*/ +func (a *PipelinesApiService) GetPipelineVariableForUser(ctx context.Context, username string, variableUuid string) (PipelineVariable, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineVariable + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/pipelines_config/variables/{variable_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"variable_uuid"+"}", fmt.Sprintf("%v", variableUuid), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Find account level variables. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @return PaginatedPipelineVariables*/ +func (a *PipelinesApiService) GetPipelineVariablesForTeam(ctx context.Context, username string) (PaginatedPipelineVariables, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedPipelineVariables + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/pipelines_config/variables/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Find user level variables. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @return PaginatedPipelineVariables*/ +func (a *PipelinesApiService) GetPipelineVariablesForUser(ctx context.Context, username string) (PaginatedPipelineVariables, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedPipelineVariables + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/pipelines_config/variables/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Find pipelines + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @return PaginatedPipelines*/ +func (a *PipelinesApiService) GetPipelinesForRepository(ctx context.Context, username string, repoSlug string) (PaginatedPipelines, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedPipelines + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve the repository pipelines configuration. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @return PipelinesConfig*/ +func (a *PipelinesApiService) GetRepositoryPipelineConfig(ctx context.Context, username string, repoSlug string) (PipelinesConfig, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelinesConfig + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve a repository level known host. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param knownHostUuid The UUID of the known host to retrieve. + @return PipelineKnownHost*/ +func (a *PipelinesApiService) GetRepositoryPipelineKnownHost(ctx context.Context, username string, repoSlug string, knownHostUuid string) (PipelineKnownHost, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineKnownHost + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"known_host_uuid"+"}", fmt.Sprintf("%v", knownHostUuid), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Find repository level known hosts. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @return PaginatedPipelineKnownHosts*/ +func (a *PipelinesApiService) GetRepositoryPipelineKnownHosts(ctx context.Context, username string, repoSlug string) (PaginatedPipelineKnownHosts, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedPipelineKnownHosts + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve a schedule by its UUID. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param scheduleUuid The uuid of the schedule. + @return PipelineSchedule*/ +func (a *PipelinesApiService) GetRepositoryPipelineSchedule(ctx context.Context, username string, repoSlug string, scheduleUuid string) (PipelineSchedule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineSchedule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"schedule_uuid"+"}", fmt.Sprintf("%v", scheduleUuid), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve the executions of a given schedule. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @return PaginatedPipelineScheduleExecutions*/ +func (a *PipelinesApiService) GetRepositoryPipelineScheduleExecutions(ctx context.Context, username string, repoSlug string) (PaginatedPipelineScheduleExecutions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedPipelineScheduleExecutions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}/executions/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve the configured schedules for the given repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @return PaginatedPipelineSchedules*/ +func (a *PipelinesApiService) GetRepositoryPipelineSchedules(ctx context.Context, username string, repoSlug string) (PaginatedPipelineSchedules, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedPipelineSchedules + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/schedules/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve the repository SSH key pair excluding the SSH private key. The private key is a write only field and will never be exposed in the logs or the REST API. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @return PipelineSshKeyPair*/ +func (a *PipelinesApiService) GetRepositoryPipelineSshKeyPair(ctx context.Context, username string, repoSlug string) (PipelineSshKeyPair, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineSshKeyPair + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/ssh/key_pair" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Retrieve a repository level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param variableUuid The UUID of the variable to retrieve. + @return PipelineVariable*/ +func (a *PipelinesApiService) GetRepositoryPipelineVariable(ctx context.Context, username string, repoSlug string, variableUuid string) (PipelineVariable, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineVariable + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/variables/{variable_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"variable_uuid"+"}", fmt.Sprintf("%v", variableUuid), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Find repository level variables. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @return PaginatedPipelineVariables*/ +func (a *PipelinesApiService) GetRepositoryPipelineVariables(ctx context.Context, username string, repoSlug string) (PaginatedPipelineVariables, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedPipelineVariables + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/variables/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Signal the stop of a pipeline and all of its steps that not have completed yet. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param pipelineUuid The UUID of the pipeline. + @return */ +func (a *PipelinesApiService) StopPipeline(ctx context.Context, username string, repoSlug string, pipelineUuid 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 + "/repositories/{username}/{repo_slug}/pipelines/{pipeline_uuid}/stopPipeline" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pipeline_uuid"+"}", fmt.Sprintf("%v", pipelineUuid), -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 + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PipelinesApiService + Update a team level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param variableUuid The UUID of the variable. + @param body The updated variable. + @return PipelineVariable*/ +func (a *PipelinesApiService) UpdatePipelineVariableForTeam(ctx context.Context, username string, variableUuid string, body PipelineVariable) (PipelineVariable, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineVariable + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/pipelines_config/variables/{variable_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"variable_uuid"+"}", fmt.Sprintf("%v", variableUuid), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Update a user level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param variableUuid The UUID of the variable. + @param body The updated variable. + @return PipelineVariable*/ +func (a *PipelinesApiService) UpdatePipelineVariableForUser(ctx context.Context, username string, variableUuid string, body PipelineVariable) (PipelineVariable, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineVariable + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/pipelines_config/variables/{variable_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"variable_uuid"+"}", fmt.Sprintf("%v", variableUuid), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Update the next build number that should be assigned to a pipeline. The next build number that will be configured has to be strictly higher than the current latest build number for this repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param body The build number to update. + @return PipelineBuildNumber*/ +func (a *PipelinesApiService) UpdateRepositoryBuildNumber(ctx context.Context, username string, repoSlug string, body PipelineBuildNumber) (PipelineBuildNumber, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineBuildNumber + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/build_number" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Update the pipelines configuration for a repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param body The updated repository pipelines configuration. + @return PipelinesConfig*/ +func (a *PipelinesApiService) UpdateRepositoryPipelineConfig(ctx context.Context, username string, repoSlug string, body PipelinesConfig) (PipelinesConfig, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelinesConfig + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Create or update the repository SSH key pair. The private key will be set as a default SSH identity in your build container. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param body The created or updated SSH key pair. + @return PipelineSshKeyPair*/ +func (a *PipelinesApiService) UpdateRepositoryPipelineKeyPair(ctx context.Context, username string, repoSlug string, body PipelineSshKeyPair) (PipelineSshKeyPair, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineSshKeyPair + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/ssh/key_pair" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Update a repository level known host. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param knownHostUuid The UUID of the known host to update. + @param body The updated known host. + @return PipelineKnownHost*/ +func (a *PipelinesApiService) UpdateRepositoryPipelineKnownHost(ctx context.Context, username string, repoSlug string, knownHostUuid string, body PipelineKnownHost) (PipelineKnownHost, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineKnownHost + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"known_host_uuid"+"}", fmt.Sprintf("%v", knownHostUuid), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Update a schedule. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param scheduleUuid The uuid of the schedule. + @param body The schedule to update. + @return PipelineSchedule*/ +func (a *PipelinesApiService) UpdateRepositoryPipelineSchedule(ctx context.Context, username string, repoSlug string, scheduleUuid string, body PipelineSchedule) (PipelineSchedule, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineSchedule + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"schedule_uuid"+"}", fmt.Sprintf("%v", scheduleUuid), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PipelinesApiService + Update a repository level variable. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account. + @param repoSlug The repository. + @param variableUuid The UUID of the variable to update. + @param body The updated variable + @return PipelineVariable*/ +func (a *PipelinesApiService) UpdateRepositoryPipelineVariable(ctx context.Context, username string, repoSlug string, variableUuid string, body PipelineVariable) (PipelineVariable, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PipelineVariable + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pipelines_config/variables/{variable_uuid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"variable_uuid"+"}", fmt.Sprintf("%v", variableUuid), -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 successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/pipelines_config.go b/pipelines_config.go new file mode 100644 index 0000000..120490b --- /dev/null +++ b/pipelines_config.go @@ -0,0 +1,21 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PipelinesConfig struct { + + Type_ string `json:"type"` + + // Whether Pipelines is enabled for the repository. + Enabled bool `json:"enabled,omitempty"` + + Repository *Repository `json:"repository,omitempty"` +} diff --git a/project.go b/project.go new file mode 100644 index 0000000..0ed3ad8 --- /dev/null +++ b/project.go @@ -0,0 +1,42 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Project struct { + + Type_ string `json:"type"` + + Links *ProjectLinks `json:"links,omitempty"` + + // The project's immutable id. + Uuid string `json:"uuid,omitempty"` + + // The project's key. + Key string `json:"key,omitempty"` + + Owner *Team `json:"owner,omitempty"` + + // The name of the project. + Name string `json:"name,omitempty"` + + Description string `json:"description,omitempty"` + + // Indicates whether the project is publicly accessible, or whether it is private to the team and consequently only visible to team members. Note that private projects cannot contain public repositories. + IsPrivate bool `json:"is_private,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + UpdatedOn time.Time `json:"updated_on,omitempty"` +} diff --git a/project_links.go b/project_links.go new file mode 100644 index 0000000..df635b7 --- /dev/null +++ b/project_links.go @@ -0,0 +1,18 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type ProjectLinks struct { + + Html *MilestoneLinksSelf `json:"html,omitempty"` + + Avatar *MilestoneLinksSelf `json:"avatar,omitempty"` +} diff --git a/projects_api.go b/projects_api.go new file mode 100644 index 0000000..b76d370 --- /dev/null +++ b/projects_api.go @@ -0,0 +1,421 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type ProjectsApiService service + + +/* ProjectsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The team which owns the project. This can either be the `username` of the team or the `UUID` of the team (surrounded by curly-braces (`{}`)). + @return PaginatedProjects*/ +func (a *ProjectsApiService) TeamsUsernameProjectsGet(ctx context.Context, username string) (PaginatedProjects, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedProjects + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/projects/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* ProjectsApiService + Creates a new project. Note that the avatar has to be embedded as either a data-url or a URL to an external image as shown in the examples below: ``` $ body=$(cat << EOF { \"name\": \"Mars Project\", \"key\": \"MARS\", \"description\": \"Software for colonizing mars.\", \"links\": { \"avatar\": { \"href\": \"data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/...\" } }, \"is_private\": false } EOF ) $ curl -H \"Content-Type: application/json\" \\ -X POST \\ -d \"$body\" \\ https://api.bitbucket.org/2.0/teams/teams-in-space/projects/ | jq . { // Serialized project document } ``` or even: ``` $ body=$(cat << EOF { \"name\": \"Mars Project\", \"key\": \"MARS\", \"description\": \"Software for colonizing mars.\", \"links\": { \"avatar\": { \"href\": \"http://i.imgur.com/72tRx4w.gif\" } }, \"is_private\": false } EOF ) $ curl -H \"Content-Type: application/json\" \\ -X POST \\ -d \"$body\" \\ https://api.bitbucket.org/2.0/teams/teams-in-space/projects/ | jq . { // Serialized project document } ``` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The team which owns the project. This can either be the `username` of the team or the `UUID` of the team (surrounded by curly-braces (`{}`)). + @param body + @return Project*/ +func (a *ProjectsApiService) TeamsUsernameProjectsPost(ctx context.Context, username string, body Project) (Project, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Project + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/projects/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* ProjectsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The team which owns the project. This can either be the `username` of the team or the `UUID` of the team (surrounded by curly-braces (`{}`)). + @param projectKey The project in question. This can either be the actual `key` assigned to the project or the `UUID` (surrounded by curly-braces (`{}`)). + @return */ +func (a *ProjectsApiService) TeamsUsernameProjectsProjectKeyDelete(ctx context.Context, username string, 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 + "/teams/{username}/projects/{project_key}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project_key"+"}", 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* ProjectsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The team which owns the project. This can either be the `username` of the team or the `UUID` of the team (surrounded by curly-braces (`{}`)). + @param projectKey The project in question. This can either be the actual `key` assigned to the project or the `UUID` (surrounded by curly-braces (`{}`)). + @return Project*/ +func (a *ProjectsApiService) TeamsUsernameProjectsProjectKeyGet(ctx context.Context, username string, projectKey string) (Project, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Project + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/projects/{project_key}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project_key"+"}", 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* ProjectsApiService + Since this endpoint can be used to both update and to create a project, the request body depends on the intent. ### Creation See the POST documentation for the project collection for an example of the request body. Note: The `key` should not be specified in the body of request (since it is already present in the URL). The `name` is required, everything else is optional. ### Update See the POST documentation for the project collection for an example of the request body. Note: The key is not required in the body (since it is already in the URL). The key may be specified in the body, if the intent is to change the key itself. In such a scenario, the location of the project is changed and is returned in the `Location` header of the response. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The team which owns the project. This can either be the `username` of the team or the `UUID` of the team (surrounded by curly-braces (`{}`)). + @param projectKey The project in question. This can either be the actual `key` assigned to the project or the `UUID` (surrounded by curly-braces (`{}`)). + @param body + @return Project*/ +func (a *ProjectsApiService) TeamsUsernameProjectsProjectKeyPut(ctx context.Context, username string, projectKey string, body Project) (Project, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Project + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/projects/{project_key}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"project_key"+"}", 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 + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/pullrequest.go b/pullrequest.go new file mode 100644 index 0000000..4579073 --- /dev/null +++ b/pullrequest.go @@ -0,0 +1,67 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Pullrequest struct { + + Type_ string `json:"type"` + + Links *PullrequestLinks `json:"links,omitempty"` + + // The pull request's unique ID. Note that pull request IDs are only unique within their associated repository. + Id int32 `json:"id,omitempty"` + + // Title of the pull request. + Title string `json:"title,omitempty"` + + Summary *PullrequestSummary `json:"summary,omitempty"` + + // The pull request's current status. + State string `json:"state,omitempty"` + + Author *Account `json:"author,omitempty"` + + Source *PullrequestEndpoint `json:"source,omitempty"` + + Destination *PullrequestEndpoint `json:"destination,omitempty"` + + MergeCommit *PullrequestMergeCommit `json:"merge_commit,omitempty"` + + // The number of comments for a specific pull request. + CommentCount int32 `json:"comment_count,omitempty"` + + // The number of open tasks for a specific pull request. + TaskCount int32 `json:"task_count,omitempty"` + + // A boolean flag indicating if merging the pull request closes the source branch. + CloseSourceBranch bool `json:"close_source_branch,omitempty"` + + ClosedBy *Account `json:"closed_by,omitempty"` + + // Explains why a pull request was declined. This field is only applicable to pull requests in rejected state. + Reason string `json:"reason,omitempty"` + + // The ISO8601 timestamp the request was created. + CreatedOn time.Time `json:"created_on,omitempty"` + + // The ISO8601 timestamp the request was last updated. + UpdatedOn time.Time `json:"updated_on,omitempty"` + + // The list of users that were added as reviewers on this pull request when it was created. For performance reasons, the API only includes this list on a pull request's `self` URL. + Reviewers []Account `json:"reviewers,omitempty"` + + // The list of users that are collaborating on this pull request. Collaborators are user that: * are added to the pull request as a reviewer (part of the reviewers list) * are not explicit reviewers, but have commented on the pull request * are not explicit reviewers, but have approved the pull request Each user is wrapped in an object that indicates the user's role and whether they have approved the pull request. For performance reasons, the API only returns this list when an API requests a pull request by id. + Participants []Participant `json:"participants,omitempty"` +} diff --git a/pullrequest_comment.go b/pullrequest_comment.go new file mode 100644 index 0000000..53c41a1 --- /dev/null +++ b/pullrequest_comment.go @@ -0,0 +1,40 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type PullrequestComment struct { + + Type_ string `json:"type"` + + Id int32 `json:"id,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + UpdatedOn time.Time `json:"updated_on,omitempty"` + + Content *PullrequestSummary `json:"content,omitempty"` + + User *User `json:"user,omitempty"` + + Deleted bool `json:"deleted,omitempty"` + + Parent *Comment `json:"parent,omitempty"` + + Inline *CommentInline `json:"inline,omitempty"` + + Links *CommentLinks `json:"links,omitempty"` + + PullRequest *Pullrequest `json:"pull_request,omitempty"` +} diff --git a/pullrequest_endpoint.go b/pullrequest_endpoint.go new file mode 100644 index 0000000..bc50aab --- /dev/null +++ b/pullrequest_endpoint.go @@ -0,0 +1,20 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PullrequestEndpoint struct { + + Repository *Repository `json:"repository,omitempty"` + + Branch *PullrequestEndpointBranch `json:"branch,omitempty"` + + Commit *PullrequestMergeCommit `json:"commit,omitempty"` +} diff --git a/pullrequest_endpoint_branch.go b/pullrequest_endpoint_branch.go new file mode 100644 index 0000000..1e468c5 --- /dev/null +++ b/pullrequest_endpoint_branch.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PullrequestEndpointBranch struct { + + Name string `json:"name,omitempty"` +} diff --git a/pullrequest_links.go b/pullrequest_links.go new file mode 100644 index 0000000..da1f7fe --- /dev/null +++ b/pullrequest_links.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PullrequestLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Html *MilestoneLinksSelf `json:"html,omitempty"` + + Commits *MilestoneLinksSelf `json:"commits,omitempty"` + + Approve *MilestoneLinksSelf `json:"approve,omitempty"` + + Diff *MilestoneLinksSelf `json:"diff,omitempty"` + + Comments *MilestoneLinksSelf `json:"comments,omitempty"` + + Activity *MilestoneLinksSelf `json:"activity,omitempty"` + + Merge *MilestoneLinksSelf `json:"merge,omitempty"` + + Decline *MilestoneLinksSelf `json:"decline,omitempty"` +} diff --git a/pullrequest_merge_commit.go b/pullrequest_merge_commit.go new file mode 100644 index 0000000..98bce9f --- /dev/null +++ b/pullrequest_merge_commit.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PullrequestMergeCommit struct { + + Hash string `json:"hash,omitempty"` +} diff --git a/pullrequest_merge_parameters.go b/pullrequest_merge_parameters.go new file mode 100644 index 0000000..bdfac5c --- /dev/null +++ b/pullrequest_merge_parameters.go @@ -0,0 +1,26 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// The metadata that describes a pull request merge. +type PullrequestMergeParameters struct { + + Type_ string `json:"type"` + + // The commit message that will be used on the resulting commit. + Message string `json:"message,omitempty"` + + // Whether the source branch should be deleted. If this is not provided, we fallback to the value used when the pull request was created, which defaults to False + CloseSourceBranch bool `json:"close_source_branch,omitempty"` + + // The merge strategy that will be used to merge the pull request. + MergeStrategy string `json:"merge_strategy,omitempty"` +} diff --git a/pullrequest_summary.go b/pullrequest_summary.go new file mode 100644 index 0000000..5c4255a --- /dev/null +++ b/pullrequest_summary.go @@ -0,0 +1,23 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type PullrequestSummary struct { + + // The text as it was typed by a user. + Raw string `json:"raw,omitempty"` + + // The type of markup language the raw content is to be interpreted in. + Markup string `json:"markup,omitempty"` + + // The user's content rendered as HTML. + Html string `json:"html,omitempty"` +} diff --git a/pullrequests_api.go b/pullrequests_api.go new file mode 100644 index 0000000..abdb174 --- /dev/null +++ b/pullrequests_api.go @@ -0,0 +1,1648 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type PullrequestsApiService service + + +/* PullrequestsApiService + Returns the repository's default reviewers. These are the users that are automatically added as reviewers on every new pull request that is created. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return */ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugDefaultReviewersGet(ctx context.Context, username string, repoSlug 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 + "/repositories/{username}/{repo_slug}/default-reviewers" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PullrequestsApiService + Removes a default reviewer from the repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param targetUsername + @param repoSlug + @return ModelError*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameDelete(ctx context.Context, username string, targetUsername string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/default-reviewers/{target_username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"target_username"+"}", fmt.Sprintf("%v", targetUsername), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Returns the specified reviewer. This can be used to test whether a user is among the repository's default reviewers list. A 404 indicates that that specified user is not a default reviewer. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param targetUsername + @param repoSlug + @return ModelError*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernameGet(ctx context.Context, username string, targetUsername string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/default-reviewers/{target_username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"target_username"+"}", fmt.Sprintf("%v", targetUsername), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Adds the specified user to the repository's list of default reviewers. This method is idempotent. Adding a user a second time has no effect. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param targetUsername + @param repoSlug + @return ModelError*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugDefaultReviewersTargetUsernamePut(ctx context.Context, username string, targetUsername string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/default-reviewers/{target_username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"target_username"+"}", fmt.Sprintf("%v", targetUsername), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Returns a paginated list of the pull request's activity log. This includes comments that were made by the reviewers, updates and approvals. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param pullRequestId The id of the pull request. + @return */ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsActivityGet(ctx context.Context, username string, repoSlug string, pullRequestId 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 + "/repositories/{username}/{repo_slug}/pullrequests/activity" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PullrequestsApiService + Returns a paginated list of all pull requests on the specified repository. By default only open pull requests are returned. This can be controlled using the `state` query parameter. To retrieve pull requests that are in one of multiple states, repeat the `state` parameter for each individual state. This endpoint also supports filtering and sorting of the results. See [filtering and sorting](../../../../meta/filtering) for more details. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param optional (nil or map[string]interface{}) with one or more of: + @param "state" (string) Only return pull requests that are in this state. This parameter can be repeated. + @return PaginatedPullrequests*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsGet(ctx context.Context, username string, repoSlug string, localVarOptionals map[string]interface{}) (PaginatedPullrequests, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedPullrequests + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["state"], "string", "state"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["state"].(string); localVarOk { + localVarQueryParams.Add("state", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Creates a new pull request. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (Pullrequest) The new pull request. The request URL you POST to becomes the destination repository URL. For this reason, you must specify an explicit source repository in the request object if you want to pull from a different repository (fork). Since not all elements are required or even mutable, you only need to include the elements you want to initialize, such as the source branch and the title. + @return Pullrequest*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPost(ctx context.Context, username string, repoSlug string, localVarOptionals map[string]interface{}) (Pullrequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Pullrequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(Pullrequest); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Returns a paginated list of the pull request's activity log. This includes comments that were made by the reviewers, updates and approvals. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param pullRequestId The id of the pull request. + @return */ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdActivityGet(ctx context.Context, username string, repoSlug string, pullRequestId 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 + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/activity" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PullrequestsApiService + Redact the authenticated user's approval of the specified pull request. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param pullRequestId + @param repoSlug + @return */ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApproveDelete(ctx context.Context, username string, pullRequestId string, repoSlug 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 + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/approve" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* PullrequestsApiService + Approve the specified pull request as the authenticated user. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param pullRequestId + @param repoSlug + @return Participant*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdApprovePost(ctx context.Context, username string, pullRequestId string, repoSlug string) (Participant, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Participant + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/approve" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Returns a specific pull request comment. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param pullRequestId + @param commentId + @param repoSlug + @return PullrequestComment*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsCommentIdGet(ctx context.Context, username string, pullRequestId string, commentId string, repoSlug string) (PullrequestComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PullrequestComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/comments/{comment_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"comment_id"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Returns a paginated list of the pull request's comments. This includes both global, inline comments and replies. The default sorting is oldest to newest and can be overridden with the `sort` query parameter. This endpoint also supports filtering and sorting of the results. See [filtering and sorting](../../../../../../meta/filtering) for more details. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the account, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param pullRequestId The id of the pull request. + @return PaginatedPullrequestComments*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsGet(ctx context.Context, username string, repoSlug string, pullRequestId int32) (PaginatedPullrequestComments, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedPullrequestComments + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/comments" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Returns a paginated list of the pull request's commits. These are the commits that are being merged into the destination branch when the pull requests gets accepted. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param pullRequestId + @param repoSlug + @return ModelError*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdCommitsGet(ctx context.Context, username string, pullRequestId string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/commits" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Declines the pull request. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param pullRequestId + @param repoSlug + @return Pullrequest*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDeclinePost(ctx context.Context, username string, pullRequestId string, repoSlug string) (Pullrequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Pullrequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/decline" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param pullRequestId + @param repoSlug + @return ModelError*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdDiffGet(ctx context.Context, username string, pullRequestId string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/diff" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Returns the specified pull request. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the account, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param pullRequestId The id of the pull request. + @return Pullrequest*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdGet(ctx context.Context, username string, repoSlug string, pullRequestId int32) (Pullrequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Pullrequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Merges the pull request. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param pullRequestId + @param repoSlug + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (PullrequestMergeParameters) + @return Pullrequest*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdMergePost(ctx context.Context, username string, pullRequestId string, repoSlug string, localVarOptionals map[string]interface{}) (Pullrequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Pullrequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/merge" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(PullrequestMergeParameters); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param pullRequestId + @param repoSlug + @return ModelError*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPatchGet(ctx context.Context, username string, pullRequestId string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/patch" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Mutates the specified pull request. This can be used to change the pull request's branches or description. Only open pull requests can be mutated. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param pullRequestId The id of the open pull request. + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (Pullrequest) The pull request that is to be updated. + @return Pullrequest*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdPut(ctx context.Context, username string, repoSlug string, pullRequestId int32, localVarOptionals map[string]interface{}) (Pullrequest, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Pullrequest + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(Pullrequest); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* PullrequestsApiService + Returns all statuses (e.g. build results) for the given pull request. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param pullRequestId The pull request's id + @return PaginatedCommitstatuses*/ +func (a *PullrequestsApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet(ctx context.Context, username string, repoSlug string, pullRequestId int32) (PaginatedCommitstatuses, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedCommitstatuses + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/statuses" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/refs_api.go b/refs_api.go new file mode 100644 index 0000000..f236259 --- /dev/null +++ b/refs_api.go @@ -0,0 +1,511 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type RefsApiService service + + +/* RefsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return ModelError*/ +func (a *RefsApiService) RepositoriesUsernameRepoSlugRefsBranchesGet(ctx context.Context, username string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/refs/branches" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RefsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param name + @param repoSlug + @return ModelError*/ +func (a *RefsApiService) RepositoriesUsernameRepoSlugRefsBranchesNameGet(ctx context.Context, username string, name string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/refs/branches/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RefsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return ModelError*/ +func (a *RefsApiService) RepositoriesUsernameRepoSlugRefsGet(ctx context.Context, username string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/refs" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RefsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The username for the owner of the repository. This can either be the `username` of the owner or the `UUID` of the owner (surrounded by curly-braces (`{}`)). Owners can be users or teams. + @param repoSlug The repo slug for the repository. This can either be the `repo_slug` of the repository or the `UUID` of the repository (surrounded by curly-braces (`{}`)) + @return ModelError*/ +func (a *RefsApiService) RepositoriesUsernameRepoSlugRefsTagsGet(ctx context.Context, username string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/refs/tags" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RefsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param name + @param repoSlug + @return ModelError*/ +func (a *RefsApiService) RepositoriesUsernameRepoSlugRefsTagsNameGet(ctx context.Context, username string, name string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/refs/tags/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RefsApiService + Creates a new tag in the specified repository. The payload of the POST should consist of a JSON document that contains the name of the tag and the target hash. ``` { \"name\" : \"new tag name\", \"target\" : { \"hash\" : \"target commit hash\", } } ``` This endpoint does support using short hash prefixes for the commit hash, but it may return a 400 response if the provided prefix is ambiguous. Using a full commit hash is the preferred approach. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The username for the owner of the repository. This can either be the `username` of the owner or the `UUID` of the owner (surrounded by curly-braces (`{}`)). Owners can be users or teams. + @param repoSlug The repo slug for the repository. This can either be the `repo_slug` of the repository or the `UUID` of the repository (surrounded by curly-braces (`{}`)) + @param body + @return Tag*/ +func (a *RefsApiService) RepositoriesUsernameRepoSlugRefsTagsPost(ctx context.Context, username string, repoSlug string, body Tag) (Tag, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Tag + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/refs/tags" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/repositories_api.go b/repositories_api.go new file mode 100644 index 0000000..7dfd24a --- /dev/null +++ b/repositories_api.go @@ -0,0 +1,2090 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type RepositoriesApiService service + + +/* RepositoriesApiService + Returns a paginated list of all public repositories. This endpoint also supports filtering and sorting of the results. See [filtering and sorting](../meta/filtering) for more details. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param optional (nil or map[string]interface{}) with one or more of: + @param "after" (string) Filter the results to include only repositories create on or after this [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. Example: `YYYY-MM-DDTHH:mm:ss.sssZ` + @return PaginatedRepositories*/ +func (a *RepositoriesApiService) RepositoriesGet(ctx context.Context, localVarOptionals map[string]interface{}) (PaginatedRepositories, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedRepositories + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["after"], "string", "after"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["after"].(string); localVarOk { + localVarQueryParams.Add("after", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns a paginated list of all repositories owned by the specified account or UUID. The result can be narrowed down based on the authenticated user's role. E.g. with `?role=contributor`, only those repositories that the authenticated user has write access to are returned (this includes any repo the user is an admin on, as that implies write access). This endpoint also supports filtering and sorting of the results. See [filtering and sorting](../../meta/filtering) for more details. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param optional (nil or map[string]interface{}) with one or more of: + @param "role" (string) Filters the result based on the authenticated user's role on each repository. * **member**: returns repositories to which the user has explicit read access * **contributor**: returns repositories to which the user has explicit write access * **admin**: returns repositories to which the user has explicit administrator access * **owner**: returns all repositories owned by the current user + @return PaginatedRepositories*/ +func (a *RepositoriesApiService) RepositoriesUsernameGet(ctx context.Context, username string, localVarOptionals map[string]interface{}) (PaginatedRepositories, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedRepositories + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["role"], "string", "role"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["role"].(string); localVarOk { + localVarQueryParams.Add("role", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns the specified build status for a commit. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param node The commit's SHA1 + @param key The build status' unique key + @return Commitstatus*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyGet(ctx context.Context, username string, repoSlug string, node string, key string) (Commitstatus, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Commitstatus + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Used to update the current status of a build status object on the specific commit. This operation can also be used to change other properties of the build status: * `state` * `name` * `description` * `url` * `refname` The `key` cannot be changed. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param node The commit's SHA1 + @param key The commit status' unique key + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (Commitstatus) The updated build status object + @return Commitstatus*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugCommitNodeStatusesBuildKeyPut(ctx context.Context, username string, repoSlug string, node string, key string, localVarOptionals map[string]interface{}) (Commitstatus, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Commitstatus + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{node}/statuses/build/{key}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(Commitstatus); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Creates a new build status against the specified commit. If the specified key already exists, the existing status object will be overwritten. When creating a new commit status, you can use a URI template for the URL. Templates are URLs that contain variable names that Bitbucket will evaluate at runtime whenever the URL is displayed anywhere similar to parameter substitution in [Bitbucket Connect](https://developer.atlassian.com/bitbucket/concepts/context-parameters.html). For example, one could use `https://foo.com/builds/{repository.full_name}` which Bitbucket will turn into `https://foo.com/builds/foo/bar` at render time. The context variables available are `repository` and `commit`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param node The commit's SHA1 + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (Commitstatus) The new commit status object. + @return Commitstatus*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugCommitNodeStatusesBuildPost(ctx context.Context, username string, repoSlug string, node string, localVarOptionals map[string]interface{}) (Commitstatus, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Commitstatus + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{node}/statuses/build" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(Commitstatus); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns all statuses (e.g. build results) for a specific commit. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param node The commit's SHA1 + @return PaginatedCommitstatuses*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugCommitNodeStatusesGet(ctx context.Context, username string, repoSlug string, node string) (PaginatedCommitstatuses, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedCommitstatuses + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/commit/{node}/statuses" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Deletes the repository. This is an irreversible operation. This does not affect its forks. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param optional (nil or map[string]interface{}) with one or more of: + @param "redirectTo" (string) If a repository has been moved to a new location, use this parameter to show users a friendly message in the Bitbucket UI that the repository has moved to a new location. However, a GET to this endpoint will still return a 404. + @return */ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugDelete(ctx context.Context, username string, repoSlug string, localVarOptionals map[string]interface{}) ( *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["redirectTo"], "string", "redirectTo"); err != nil { + return nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["redirectTo"].(string); localVarOk { + localVarQueryParams.Add("redirect_to", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns a paginated list of commits that modified the specified file. Commits are returned in reverse chronological order. This is roughly equivalent to the following commands: $ git log --follow --date-order <sha> <path> $ hg log --follow <path> By default, Bitbucket will follow renames and the path name in the returned entries reflects that. This can be turned off using the `?renames=false` query parameter. Results are returned in descending chronological order by default, and like most endpoints you can [filter and sort](../../../../../../meta/filtering) the response to only provide exactly the data you want. For example, if you wanted to find commits made before 2011-05-18 against a file named `README.rst`, but you only wanted the path and date, your query would look like this: ``` $ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\\ '?fields=values.next,values.path,values.commit.date&q=commit.date<=2011-05-18' { \"values\": [ { \"commit\": { \"date\": \"2011-05-17T07:32:09+00:00\" }, \"path\": \"README.rst\" }, { \"commit\": { \"date\": \"2011-05-16T06:33:28+00:00\" }, \"path\": \"README.txt\" }, { \"commit\": { \"date\": \"2011-05-16T06:15:39+00:00\" }, \"path\": \"README.txt\" } ] } ``` In the response you can see that the file was renamed to `README.rst` by the commit made on 2011-05-16, and was previously named `README.txt`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param node + @param path + @param repoSlug + @param optional (nil or map[string]interface{}) with one or more of: + @param "renames" (string) When `true`, Bitbucket will follow the history of the file across renames (this is the default behavior). This can be turned off by specifying `false`. + @param "q" (string) Query string to narrow down the response as per [filtering and sorting](../../../../../../meta/filtering). + @param "sort" (string) Name of a response property sort the result by as per [filtering and sorting](../../../../../../meta/filtering#query-sort). + @return PaginatedFiles*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugFilehistoryNodePathGet(ctx context.Context, username string, node string, path string, repoSlug string, localVarOptionals map[string]interface{}) (PaginatedFiles, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedFiles + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/filehistory/{node}/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["renames"], "string", "renames"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["q"], "string", "q"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sort"], "string", "sort"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["renames"].(string); localVarOk { + localVarQueryParams.Add("renames", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["q"].(string); localVarOk { + localVarQueryParams.Add("q", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sort"].(string); localVarOk { + localVarQueryParams.Add("sort", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns a paginated list of all the forks of the specified repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return PaginatedRepositories*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugForksGet(ctx context.Context, username string, repoSlug string) (PaginatedRepositories, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedRepositories + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/forks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Creates a new fork of the specified repository. By default, forks are created under the authenticated user's account with the same name and slug of the original repository. ``` $ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/forks { \"scm\": \"git\", \"full_name\": \"jdoe/dogslow\", \"parent\": { \"full_name\": \"evzijst/dogslow\", ... }, ... } ``` If you already have a repo with that name, then a 400 is returned and you'll need to specify a custom name for the new fork: ``` $ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/forks \\ -H 'Content-Type: application/json' -d '{ \"name\": \"dogslow_fork\" }' ``` When you specify a value for `name`, it will also affect the `slug`. The `slug` is reflected in the repository URL of the new fork. It is derived from `name` by substituting non-ASCII characters, removes whitespace, and changes characters to lower case. For example, `My repo` would turn into `my_repo`. ## Forking a repository into a team account To create a fork into a team account, specify the new owner's account explicitly as part of the request body. This prevents forked repositories from being owned by the authenticated user submitting the request: ``` $ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/atlassian/bbql/forks \\ -H 'Content-Type: application/json' -d '{ \"name\": \"bbql_fork\", \"owner\": { \"username\": \"atlassian\" } }' ``` To fork a repository into the same team, also specify a new `name`. You need contributor access to create new forks within a team account. ## Change the properties of a new fork By default the fork inherits most of its properties from the parent. However, since the optional POST body document follows the normal `repository` JSON schema and you can override the new fork's properties. Properties that can be overridden include: * description * fork_policy * language * mainbranch * is_private (note that a private repo's fork_policy might prohibit the creation of public forks, in which `is_private=False` would fail) * has_issues (to initialize or disable the new repo's issue tracker -- note that the actual contents of the parent repository's issue tracker are not copied during forking) * has_wiki (to initialize or disable the new repo's wiki -- note that the actual contents of the parent repository's wiki are not copied during forking) * project (only teams have projects and when forking into a private project, the fork's `is_private` must be `true`) Properties that cannot be modified include: * scm * parent * full_name + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (Repository) A repository object. This can be left blank. + @return Repository*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugForksPost(ctx context.Context, username string, repoSlug string, localVarOptionals map[string]interface{}) (Repository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Repository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/forks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(Repository); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns the object describing this repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @return Repository*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugGet(ctx context.Context, username string, repoSlug string) (Repository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Repository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns a paginated list of webhooks installed on this repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return PaginatedWebhookSubscriptions*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugHooksGet(ctx context.Context, username string, repoSlug string) (PaginatedWebhookSubscriptions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedWebhookSubscriptions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Creates a new webhook on the specified repository. Example: ``` $ curl -X POST -u credentials -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/repositories/username/slug/hooks -d ' { \"description\": \"Webhook Description\", \"url\": \"https://example.com/\", \"active\": true, \"events\": [ \"repo:push\", \"issue:created\", \"issue:updated\" ] }' ``` Note that this call requires the webhook scope, as well as any scope that applies to the events that the webhook subscribes to. In the example above that means: `webhook`, `repository` and `issue`. Also note that the `url` must properly resolve and cannot be an internal, non-routed address. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return WebhookSubscription*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugHooksPost(ctx context.Context, username string, repoSlug string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Deletes the specified webhook subscription from the given repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param uid The installed webhook's id + @return */ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugHooksUidDelete(ctx context.Context, username string, repoSlug string, uid 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 + "/repositories/{username}/{repo_slug}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns the webhook with the specified id installed on the specified repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param uid The installed webhook's id. + @return WebhookSubscription*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugHooksUidGet(ctx context.Context, username string, repoSlug string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param uid The installed webhook's id + @return WebhookSubscription*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugHooksUidPut(ctx context.Context, username string, repoSlug string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Creates a new repository. Note: In order to set the project for the newly created repository, pass in either the project key or the project UUID as part of the request body as shown in the examples below: ``` $ curl -X POST -H \"Content-Type: application/json\" -d '{ \"scm\": \"git\", \"project\": { \"key\": \"MARS\" } }' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding ``` or ``` $ curl -X POST -H \"Content-Type: application/json\" -d '{ \"scm\": \"git\", \"project\": { \"key\": \"{ba516952-992a-4c2d-acbd-17d502922f96}\" } }' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding ``` The project must only be assigned for repositories belonging to a team. If the repository owner is a team and the project is not provided, the repository is automatically assigned to the oldest project in the team. Note: In the examples above, the username `teamsinspace`, and/or the repository name `hablanding` can be replaced by UUIDs. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (Repository) The repository that is to be created. Note that most object elements are optional. Elements \"owner\" and \"full_name\" are ignored as the URL implies them. + @return Repository*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugPost(ctx context.Context, username string, repoSlug string, localVarOptionals map[string]interface{}) (Repository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Repository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(Repository); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns all statuses (e.g. build results) for the given pull request. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param pullRequestId The pull request's id + @return PaginatedCommitstatuses*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugPullrequestsPullRequestIdStatusesGet(ctx context.Context, username string, repoSlug string, pullRequestId int32) (PaginatedCommitstatuses, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedCommitstatuses + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/pullrequests/{pull_request_id}/statuses" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pull_request_id"+"}", fmt.Sprintf("%v", pullRequestId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Since this endpoint can be used to both update and to create a repository, the request body depends on the intent. ### Creation See the POST documentation for the repository endpoint for an example of the request body. ### Update Note: Changing the `name` of the repository will cause the location to be changed. This is because the URL of the repo is derived from the name (a process called slugification). In such a scenario, it is possible for the request to fail if the newly created slug conflicts with an existing repository's slug. But if there is no conflict, the new location will be returned in the `Location` header of the response. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username This can either be the username or the UUID of the user, surrounded by curly-braces, for example: `{user UUID}`. + @param repoSlug This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: `{repository UUID}`. + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (Repository) The repository that is to be updated. Note that the elements \"owner\" and \"full_name\" are ignored since the URL implies them. + @return Repository*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugPut(ctx context.Context, username string, repoSlug string, localVarOptionals map[string]interface{}) (Repository, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Repository + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(Repository); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + This endpoint redirects the client to the directory listing of the root directory on the main branch. This is equivalent to directly hitting [/2.0/repositories/{username}/{repo_slug}/src/{node}/{path}](src/%7Bnode%7D/%7Bpath%7D) without having to know the name or SHA1 of the repo's main branch. To create new commits, [POST to this endpoint](#post) + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param optional (nil or map[string]interface{}) with one or more of: + @param "format" (string) Instead of returning the file's contents, return the (json) meta data for it. + @return PaginatedTreeentries*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugSrcGet(ctx context.Context, username string, repoSlug string, localVarOptionals map[string]interface{}) (PaginatedTreeentries, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedTreeentries + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/src" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["format"], "string", "format"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["format"].(string); localVarOk { + localVarQueryParams.Add("format", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + This endpoints is used to retrieve the contents of a single file, or the contents of a directory at a specified revision. ## Raw file contents When `path` points to a file, this endpoint returns the raw contents. The response's Content-Type is derived from the filename extension (not from the contents). The file contents are not processed and no character encoding/recoding is performed and as a result no character encoding is included as part of the Content-Type. The `Content-Disposition` header will be \"attachment\" to prevent browsers from running executable files. If the file is managed by LFS, then a 301 redirect pointing to Atlassian's media services platform is returned. The response includes an ETag that is based on the contents of the file and its attributes. This means that an empty `__init__.py` always returns the same ETag, regardless on the directory it lives in, or the commit it is on. ## File meta data When the request for a file path includes the query parameter `?format=meta`, instead of returning the file's raw contents, Bitbucket instead returns the JSON object describing the file's properties: ```javascript $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests/__init__.py?format=meta { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\" } }, \"path\": \"tests/__init__.py\", \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } }, \"attributes\": [], \"type\": \"commit_file\", \"size\": 0 } ``` File objects contain an `attributes` element that contains a list of possible modifiers. Currently defined values are: * `link` -- indicates that the entry is a symbolic link. The contents of the file represent the path the link points to. * `executable` -- indicates that the file has the executable bit set. * `subrepository` -- indicates that the entry points to a submodule or subrepo. The contents of the file is the SHA1 of the repository pointed to. * `binary` -- indicates whether Bitbucket thinks the file is binary. This endpoint can provide an alternative to how a HEAD request can be used to check for the existence of a file, or a file's size without incurring the overhead of receiving its full contents. ## Directory listings When `path` points to a directory instead of a file, the response is a paginated list of directory and file objects in the same order as the underlying SCM system would return them. For example: ```javascript $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests { \"pagelen\": 10, \"values\": [ { \"path\": \"tests/test_project\", \"type\": \"commit_directory\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\" } }, \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } } }, { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\" } }, \"path\": \"tests/__init__.py\", \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } }, \"attributes\": [], \"type\": \"commit_file\", \"size\": 0 } ], \"page\": 1, \"size\": 2 } ``` When listing the contents of the repo's root directory, the use of a trailing slash at the end of the URL is required. The response is not recursive, meaning that only the direct contents of a path are returned. The response does not recurse down into subdirectories. In order to \"walk\" the entire directory tree, the client needs to parse each response and follow the `self` links of each `commit_directory` object. Each returned object is either a `commit_file`, or a `commit_directory`, both of which contain a `path` element. This path is the absolute path from the root of the repository. Each object also contains a `commit` object which embeds the commit the file is on. Note that this is merely the commit that was used in the URL. It is *not* the commit that last modified the file. Directory objects have 2 representations. Their `self` link returns the paginated contents of the directory. The `meta` link on the other hand returns the actual `directory` object itself, e.g.: ```javascript { \"path\": \"tests/test_project\", \"type\": \"commit_directory\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\" } }, \"commit\": { ... } } ``` ## Querying, filtering and sorting Like most API endpoints, this API supports the Bitbucket querying/filtering syntax and so you could filter a directory listing to only include entries that match certain criteria. For instance, to list all binary files over 1kb use the expression: `size > 1024 and attributes = \"binary\"` which after urlencoding yields the query string: `?q=size%3E1024+and+attributes%3D%22binary%22` To change the ordering of the response, use the `?sort` parameter: `.../src/eefd5ef/?sort=-size` See [filtering and sorting](../../../../../../meta/filtering) for more details. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param node + @param path + @param repoSlug + @param optional (nil or map[string]interface{}) with one or more of: + @param "format" (string) If 'meta' is provided, returns the (json) meta data for the contents of the file. If 'rendered' is provided, returns the contents of a non-binary file in HTML-formatted rendered markup. Since Git and Mercurial do not generally track what text encoding scheme is used, this endpoint attempts to detect the most appropriate character encoding. While usually correct, determining the character encoding can be ambiguous which in exceptional cases can lead to misinterpretation of the characters. As such, the raw element in the response object should not be treated as equivalent to the file's actual contents. + @param "q" (string) Optional filter expression as per [filtering and sorting](../../../../../../meta/filtering). + @param "sort" (string) Optional sorting parameter as per [filtering and sorting](../../../../../../meta/filtering#query-sort). + @return PaginatedTreeentries*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugSrcNodePathGet(ctx context.Context, username string, node string, path string, repoSlug string, localVarOptionals map[string]interface{}) (PaginatedTreeentries, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedTreeentries + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/src/{node}/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["format"], "string", "format"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["q"], "string", "q"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sort"], "string", "sort"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["format"].(string); localVarOk { + localVarQueryParams.Add("format", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["q"].(string); localVarOk { + localVarQueryParams.Add("q", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sort"].(string); localVarOk { + localVarQueryParams.Add("sort", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + This endpoint is used to create new commits in the repository by uploading files. To add a new file to a repository: ``` $ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \\ -F /repo/path/to/image.png=@image.png ``` This will create a new commit on top of the main branch, inheriting the contents of the main branch, but adding (or overwriting) the `image.png` file to the repository in the `/repo/path/to` directory. This endpoint accepts `multipart/form-data` (as in the example above), as well as `application/x-www-form-urlencoded`. ## multipart/form-data A `multipart/form-data` post contains a series of \"form fields\" that identify both the individual files that are being uploaded, as well as additional, optional meta data. Files are uploaded in file form fields (those that have a `Content-Disposition` parameter) whose field names point to the remote path in the repository where the file should be stored. Path field names are always interpreted to be absolute from the root of the repository, regardless whether the client uses a leading slash (as the above `curl` example did). File contents are treated as bytes and are not decoded as text. The commit message, as well as other non-file meta data for the request, is sent along as normal form field elements. Meta data fields share the same namespace as the file objects. For `multipart/form-data` bodies that should not lead to any ambiguity, as the `Content-Disposition` header will contain the `filename` parameter to distinguish between a file named \"message\" and the commit message field. ## application/x-www-form-urlencoded It is also possible to upload new files using a simple `application/x-www-form-urlencoded` POST. This can be convenient when uploading pure text files: ``` $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/ \\ --data-urlencode \"/path/to/me.txt=Lorem ipsum.\" \\ --data-urlencode \"message=Initial commit\" \\ --data-urlencode \"author=Erik van Zijst <erik.van.zijst@gmail.com>\" ``` There could be a field name clash if a client were to upload a file named \"message\", as this filename clashes with the meta data property for the commit message. To avoid this and to upload files whose names clash with the meta data properties, use a leading slash for the files, e.g. `curl --data-urlencode \"/message=file contents\"`. When an explicit slash is omitted for a file whose path matches that of a meta data parameter, then it is interpreted as meta data, not as a file. ## Executables and links While this API aims to facilitate the most common use cases, it is possible to perform some more advanced operations like creating a new symlink in the repository, or creating an executable file. Files can be supplied with a `x-attributes` value in the `Content-Disposition` header. For example, to upload an executable file, as well as create a symlink from `README.txt` to `README`: ``` --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"bin/shutdown.sh\" Content-Disposition: attachment; filename=\"shutdown.sh\"; x-attributes:\"executable\" #!/bin/sh halt --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"/README.txt\" Content-Disposition: attachment; filename=\"README.txt\"; x-attributes:\"link\" README --===============1438169132528273974==-- ``` Links are files that contain the target path and have `x-attributes:\"link\"` set. When overwriting links with files, or vice versa, the newly uploaded file determines both the new contents, as well as the attributes. That means uploading a file without specifying `x-attributes=\"link\"` will create a regular file, even if the parent commit hosted a symlink at the same path. The same applies to executables. When modifying an existing executable file, the form-data file element must include `x-attributes=\"executable\"` in order to preserve the executable status of the file. Note that this API does not support the creation or manipulation of subrepos / submodules. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param optional (nil or map[string]interface{}) with one or more of: + @param "message" (string) The commit message. When omitted, Bitbucket uses a canned string. + @param "author" (string) The raw string to be used as the new commit's author. This string follows the format `Erik van Zijst <evzijst@atlassian.com>`. When omitted, Bitbucket uses the authenticated user's full/display name and primary email address. Commits cannot be created anonymously. + @param "parents" (string) A comma-separated list of SHA1s of the commits that should be the parents of the newly created commit. When omitted, the new commit will inherit from and become a child of the main branch's tip/HEAD commit. When more than one SHA1 is provided, the first SHA1 identifies the commit from which the content will be inherited. When more than 2 parents are provided on a Mercurial repo, a 400 is returned as Mercurial does not support \"octopus merges\". + @param "files" (string) Optional field that declares the files that the request is manipulating. When adding a new file to a repo, or when overwriting an existing file, the client can just upload the full contents of the file in a normal form field and the use of this `files` meta data field is redundant. However, when the `files` field contains a file path that does not have a corresponding, identically-named form field, then Bitbucket interprets that as the client wanting to replace the named file with the null set and the file is deleted instead. Paths in the repo that are referenced in neither files nor an individual file field, remain unchanged and carry over from the parent to the new commit. This API does not support renaming as an explicit feature. To rename a file, simply delete it and recreate it under the new name in the same commit. + @param "files2" (string) The name of the branch that the new commit should be created on. When omitted, the commit will be created on top of the main branch and will become the main branch's new HEAD/tip. When a branch name is provided that already exists in the repo, then the commit will be created on top of that branch. In this case, if a parent SHA1 was also provided, then it is asserted that the parent is the branch's tip/HEAD at the time the request is made. When this is not the case, a 409 is returned. This API cannot be used to create new anonymous heads in Mercurial repos. When a new branch name is specified (that does not already exist in the repo), and no parent SHA1s are provided, then the new commit will inherit from the current main branch's tip/HEAD commit, but not advance the main branch. The new commit will be the new branch. When the request also specifies a parent SHA1, then the new commit and branch are created directly on top of the parent commit, regardless of the state of the main branch. When a branch name is not specified, but a parent SHA1 is provided, then Bitbucket asserts that it represents the main branch's current HEAD/tip, or a 409 is returned. When a branch name is not specified and the repo is empty, the new commit will become the repo's root commit and will be on the main branch. When a branch name is specified and the repo is empty, the new commit will become the repo's root commit and also define the repo's main branch going forward. This API cannot be used to create additional root commits in non-empty repos. The branch field cannot be repeated. As a side effect, this API can be used to create a new branch without modifying any files, by specifying a new branch name in this field, together with parents, but omitting the files fields, while not sending any files. This will create a new commit and branch with the same contents as the first parent. The diff of this commit against its first parent will be empty. + @param "branch" (string) The name of the branch that the new commit should be created on. When omitted, the commit will be created on top of the main branch and will become the main branch's new head. When a branch name is provided that already exists in the repo, then the commit will be created on top of that branch. In this case, *if* a parent SHA1 was also provided, then it is asserted that the parent is the branch's tip/HEAD at the time the request is made. When this is not the case, a 409 is returned. This API cannot be used to create new anonymous heads in Mercurial repositories. When a new branch name is specified (that does not already exist in the repo), and no parent SHA1s are provided, then the new commit will inherit from the current main branch's tip/HEAD commit, but not advance the main branch. The new commit will be the new branch. When the request *also* specifies a parent SHA1, then the new commit and branch are created directly on top of the parent commit, regardless of the state of the main branch. When a branch name is not specified, but a parent SHA1 is provided, then Bitbucket asserts that it represents the main branch's current HEAD/tip, or a 409 is returned. When a branch name is not specified and the repo is empty, the new commit will become the repo's root commit and will be on the main branch. When a branch name is specified and the repo is empty, the new commit will become the repo's root commit and also define the repo's main branch going forward. This API cannot be used to create additional root commits in non-empty repos. The branch field cannot be repeated. As a side effect, this API can be used to create a new branch without modifying any files, by specifying a new branch name in this field, together with `parents`, but omitting the `files` fields, while not sending any files. This will create a new commit and branch with the same contents as the first parent. The diff of this commit against its first parent will be empty. + @return */ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugSrcPost(ctx context.Context, username string, repoSlug string, localVarOptionals map[string]interface{}) ( *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/src" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["message"], "string", "message"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["author"], "string", "author"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["parents"], "string", "parents"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["files"], "string", "files"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["files2"], "string", "files2"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["branch"], "string", "branch"); err != nil { + return nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["message"].(string); localVarOk { + localVarQueryParams.Add("message", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["author"].(string); localVarOk { + localVarQueryParams.Add("author", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["parents"].(string); localVarOk { + localVarQueryParams.Add("parents", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["files"].(string); localVarOk { + localVarQueryParams.Add("files", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["files2"].(string); localVarOk { + localVarQueryParams.Add("files", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["branch"].(string); localVarOk { + localVarQueryParams.Add("branch", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns a paginated list of all the watchers on the specified repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return ModelError*/ +func (a *RepositoriesApiService) RepositoriesUsernameRepoSlugWatchersGet(ctx context.Context, username string, repoSlug string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/watchers" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* RepositoriesApiService + Returns an object for each repository the caller has explicit access to and their effective permission — the highest level of permission the caller has. This does not return public repositories that the user was not granted any specific permission in, and does not distinguish between direct and indirect privileges. Permissions can be: * `admin` * `write` * `read` Example: ``` $ curl https://api.bitbucket.org/2.0/user/permissions/repositories { \"pagelen\": 10, \"values\": [ { \"type\": \"repository_permission\", \"user\": { \"type\": \"user\", \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\" }, \"repository\": { \"type\": \"repository\", \"name\": \"geordi\", \"full_name\": \"bitbucket/geordi\", \"uuid\": \"{85d08b4e-571d-44e9-a507-fa476535aa98}\" }, \"permission\": \"admin\" } ], \"page\": 1, \"size\": 1 } ``` Results may be further [filtered or sorted](../../../meta/filtering) by repository or permission by adding the following query string parameters: * `q=repository.name=\"geordi\"` or `q=permission>\"read\"` * `sort=repository.name` Note that the query parameter values need to be URL escaped so that `=` would become `%3D`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param optional (nil or map[string]interface{}) with one or more of: + @param "q" (string) Query string to narrow down the response as per [filtering and sorting](../../../meta/filtering). + @param "sort" (string) Name of a response property sort the result by as per [filtering and sorting](../../../meta/filtering#query-sort). + @return PaginatedRepositoryPermissions*/ +func (a *RepositoriesApiService) UserPermissionsRepositoriesGet(ctx context.Context, localVarOptionals map[string]interface{}) (PaginatedRepositoryPermissions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedRepositoryPermissions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user/permissions/repositories" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["q"], "string", "q"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sort"], "string", "sort"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["q"].(string); localVarOk { + localVarQueryParams.Add("q", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sort"].(string); localVarOk { + localVarQueryParams.Add("sort", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/repository.go b/repository.go new file mode 100644 index 0000000..5845414 --- /dev/null +++ b/repository.go @@ -0,0 +1,57 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Repository struct { + + Type_ string `json:"type"` + + Links *RepositoryLinks `json:"links,omitempty"` + + // The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user. + Uuid string `json:"uuid,omitempty"` + + // The concatenation of the repository owner's username and the slugified name, e.g. \"evzijst/interruptingcow\". This is the same string used in Bitbucket URLs. + FullName string `json:"full_name,omitempty"` + + IsPrivate bool `json:"is_private,omitempty"` + + Parent *Repository `json:"parent,omitempty"` + + Scm string `json:"scm,omitempty"` + + Owner *Account `json:"owner,omitempty"` + + Name string `json:"name,omitempty"` + + Description string `json:"description,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + UpdatedOn time.Time `json:"updated_on,omitempty"` + + Size int32 `json:"size,omitempty"` + + Language string `json:"language,omitempty"` + + HasIssues bool `json:"has_issues,omitempty"` + + HasWiki bool `json:"has_wiki,omitempty"` + + // Controls the rules for forking this repository. * **allow_forks**: unrestricted forking * **no_public_forks**: restrict forking to private forks (forks cannot be made public later) * **no_forks**: deny all forking + ForkPolicy string `json:"fork_policy,omitempty"` + + Project *Project `json:"project,omitempty"` +} diff --git a/repository_links.go b/repository_links.go new file mode 100644 index 0000000..ef1e473 --- /dev/null +++ b/repository_links.go @@ -0,0 +1,34 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type RepositoryLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Html *MilestoneLinksSelf `json:"html,omitempty"` + + Avatar *MilestoneLinksSelf `json:"avatar,omitempty"` + + Pullrequests *MilestoneLinksSelf `json:"pullrequests,omitempty"` + + Commits *MilestoneLinksSelf `json:"commits,omitempty"` + + Forks *MilestoneLinksSelf `json:"forks,omitempty"` + + Watchers *MilestoneLinksSelf `json:"watchers,omitempty"` + + Downloads *MilestoneLinksSelf `json:"downloads,omitempty"` + + Clone []MilestoneLinksSelf `json:"clone,omitempty"` + + Hooks *MilestoneLinksSelf `json:"hooks,omitempty"` +} diff --git a/repository_permission.go b/repository_permission.go new file mode 100644 index 0000000..1f39813 --- /dev/null +++ b/repository_permission.go @@ -0,0 +1,23 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A user's permission for a given repository. +type RepositoryPermission struct { + + Type_ string `json:"type"` + + Permission string `json:"permission,omitempty"` + + User *User `json:"user,omitempty"` + + Repository *Repository `json:"repository,omitempty"` +} diff --git a/search_result.go b/search_result.go new file mode 100644 index 0000000..f8831ae --- /dev/null +++ b/search_result.go @@ -0,0 +1,18 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type SearchResult struct { + + Next string `json:"next,omitempty"` + + Previous string `json:"previous,omitempty"` +} diff --git a/snippet.go b/snippet.go new file mode 100644 index 0000000..80d570b --- /dev/null +++ b/snippet.go @@ -0,0 +1,37 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Snippet struct { + + Type_ string `json:"type"` + + Id int32 `json:"id,omitempty"` + + Title string `json:"title,omitempty"` + + // The DVCS used to store the snippet. + Scm string `json:"scm,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + UpdatedOn time.Time `json:"updated_on,omitempty"` + + Owner *Account `json:"owner,omitempty"` + + Creator *Account `json:"creator,omitempty"` + + IsPrivate bool `json:"is_private,omitempty"` +} diff --git a/snippet_comment.go b/snippet_comment.go new file mode 100644 index 0000000..60b8178 --- /dev/null +++ b/snippet_comment.go @@ -0,0 +1,20 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type SnippetComment struct { + + Type_ string `json:"type"` + + Links *GroupLinks `json:"links,omitempty"` + + Snippet *Snippet `json:"snippet,omitempty"` +} diff --git a/snippet_commit.go b/snippet_commit.go new file mode 100644 index 0000000..5e65964 --- /dev/null +++ b/snippet_commit.go @@ -0,0 +1,36 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type SnippetCommit struct { + + Type_ string `json:"type"` + + Hash string `json:"hash,omitempty"` + + Date time.Time `json:"date,omitempty"` + + Author *Author `json:"author,omitempty"` + + Message string `json:"message,omitempty"` + + Summary *PullrequestSummary `json:"summary,omitempty"` + + Parents []BaseCommit `json:"parents,omitempty"` + + Links *SnippetCommitLinks `json:"links,omitempty"` + + Snippet *Snippet `json:"snippet,omitempty"` +} diff --git a/snippet_commit_links.go b/snippet_commit_links.go new file mode 100644 index 0000000..9b8fe97 --- /dev/null +++ b/snippet_commit_links.go @@ -0,0 +1,20 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type SnippetCommitLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Html *MilestoneLinksSelf `json:"html,omitempty"` + + Diff *MilestoneLinksSelf `json:"diff,omitempty"` +} diff --git a/snippets_api.go b/snippets_api.go new file mode 100644 index 0000000..aa4d6a0 --- /dev/null +++ b/snippets_api.go @@ -0,0 +1,1935 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type SnippetsApiService service + + +/* SnippetsApiService + Returns all snippets. Like pull requests, repositories and teams, the full set of snippets is defined by what the current user has access to. This includes all snippets owned by the current user, but also all snippets owned by any of the teams the user is a member of, or snippets by other users that the current user is either watching or has collaborated on (for instance by commenting on it). To limit the set of returned snippets, apply the `?role=[owner|contributor|member]` query parameter where the roles are defined as follows: * `owner`: all snippets owned by the current user * `contributor`: all snippets owned by, or watched by the current user * `member`: owned by the user, their teams, or watched by the current user When no role is specified, all public snippets are returned, as well as all privately owned snippets watched or commented on. The returned response is a normal paginated JSON list. This endpoint only supports `application/json` responses and no `multipart/form-data` or `multipart/related`. As a result, it is not possible to include the file contents. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param optional (nil or map[string]interface{}) with one or more of: + @param "role" (string) Filter down the result based on the authenticated user's role (`owner`, `contributor`, or `member`). + @return PaginatedSnippets*/ +func (a *SnippetsApiService) SnippetsGet(ctx context.Context, localVarOptionals map[string]interface{}) (PaginatedSnippets, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedSnippets + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["role"], "string", "role"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["role"].(string); localVarOk { + localVarQueryParams.Add("role", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Creates a new snippet under the authenticated user's account. Snippets can contain multiple files. Both text and binary files are supported. The simplest way to create a new snippet from a local file: $ curl -u username:password -X POST https://api.bitbucket.org/2.0/snippets -F file=@image.png Creating snippets through curl has a few limitations and so let's look at a more complicated scenario. Snippets are created with a multipart POST. Both `multipart/form-data` and `multipart/related` are supported. Both allow the creation of snippets with both meta data (title, etc), as well as multiple text and binary files. The main difference is that `multipart/related` can use rich encoding for the meta data (currently JSON). multipart/related (RFC-2387) ---------------------------- This is the most advanced and efficient way to create a paste. POST /2.0/snippets/evzijst HTTP/1.1 Content-Length: 1188 Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\" MIME-Version: 1.0 --===============1438169132528273974== Content-Type: application/json; charset=\"utf-8\" MIME-Version: 1.0 Content-ID: snippet { \"title\": \"My snippet\", \"is_private\": true, \"scm\": \"hg\", \"files\": { \"foo.txt\": {}, \"image.png\": {} } } --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"foo.txt\" Content-Disposition: attachment; filename=\"foo.txt\" foo --===============1438169132528273974== Content-Type: image/png MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-ID: \"image.png\" Content-Disposition: attachment; filename=\"image.png\" iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5 EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg== --===============1438169132528273974==-- The request contains multiple parts and is structured as follows. The first part is the JSON document that describes the snippet's properties or meta data. It either has to be the first part, or the request's `Content-Type` header must contain the `start` parameter to point to it. The remaining parts are the files of which there can be zero or more. Each file part should contain the `Content-ID` MIME header through which the JSON meta data's `files` element addresses it. The value should be the name of the file. `Content-Disposition` is an optional MIME header. The header's optional `filename` parameter can be used to specify the file name that Bitbucket should use when writing the file to disk. When present, `filename` takes precedence over the value of `Content-ID`. When the JSON body omits the `files` element, the remaining parts are not ignored. Instead, each file is added to the new snippet as if its name was explicitly linked (the use of the `files` elements is mandatory for some operations like deleting or renaming files). multipart/form-data ------------------- The use of JSON for the snippet's meta data is optional. Meta data can also be supplied as regular form fields in a more conventional `multipart/form-data` request: $ curl -X POST -u credentials https://api.bitbucket.org/2.0/snippets -F title=\"My snippet\" -F file=@foo.txt -F file=@image.png POST /2.0/snippets HTTP/1.1 Content-Length: 951 Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"file\"; filename=\"foo.txt\" Content-Type: text/plain foo ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"file\"; filename=\"image.png\" Content-Type: application/octet-stream ?PNG IHDR?1??I..... ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"title\" My snippet ------------------------------63a4b224c59f-- Here the meta data properties are included as flat, top-level form fields. The file attachments use the `file` field name. To attach multiple files, simply repeat the field. The advantage of `multipart/form-data` over `multipart/related` is that it can be easier to build clients. Essentially all properties are optional, `title` and `files` included. Sharing and Visibility ---------------------- Snippets can be either public (visible to anyone on Bitbucket, as well as anonymous users), or private (visible only to the owner, creator and members of the team in case the snippet is owned by a team). This is controlled through the snippet's `is_private` element: * **is_private=false** -- everyone, including anonymous users can view the snippet * **is_private=true** -- only the owner and team members (for team snippets) can view it To create the snippet under a team account, just append the team name to the URL (see `/2.0/snippets/{username}`). + * @param ctx context.Context for authentication, logging, tracing, etc. + @param body The new snippet object. + @return Snippet*/ +func (a *SnippetsApiService) SnippetsPost(ctx context.Context, body Snippet) (Snippet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Snippet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets" + + 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 + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Deletes a snippet comment. Comments can only be removed by their author. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param commentId + @param encodedId + @return */ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdCommentsCommentIdDelete(ctx context.Context, username string, commentId string, encodedId 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 + "/snippets/{username}/{encoded_id}/comments/{comment_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"comment_id"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* SnippetsApiService + Returns the specific snippet comment. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param commentId + @param encodedId + @return SnippetComment*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdCommentsCommentIdGet(ctx context.Context, username string, commentId string, encodedId string) (SnippetComment, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload SnippetComment + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/comments/{comment_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"comment_id"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Updates a comment. Comments can only be updated by their author. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param commentId + @param encodedId + @return */ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdCommentsCommentIdPut(ctx context.Context, username string, commentId string, encodedId 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 + "/snippets/{username}/{encoded_id}/comments/{comment_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"comment_id"+"}", fmt.Sprintf("%v", commentId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* SnippetsApiService + Used to retrieve a paginated list of all comments for a specific snippet. This resource works identical to commit and pull request comments. The default sorting is oldest to newest and can be overridden with the `sort` query parameter. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId + @return PaginatedSnippetComments*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdCommentsGet(ctx context.Context, username string, encodedId string) (PaginatedSnippetComments, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedSnippetComments + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/comments" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Creates a new comment. The only required field in the body is `content.raw`. To create a threaded reply to an existing comment, include `parent.id`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId + @param body The contents of the new comment. + @return Snippet*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdCommentsPost(ctx context.Context, username string, encodedId string, body Snippet) (Snippet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Snippet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/comments" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Returns the changes (commits) made on this snippet. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId + @return PaginatedSnippetCommit*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdCommitsGet(ctx context.Context, username string, encodedId string) (PaginatedSnippetCommit, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedSnippetCommit + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/commits" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId + @param revision + @return SnippetCommit*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdCommitsRevisionGet(ctx context.Context, username string, encodedId string, revision string) (SnippetCommit, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload SnippetCommit + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/commits/{revision}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"revision"+"}", fmt.Sprintf("%v", revision), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Deletes a snippet and returns an empty response. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet's id. + @return */ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdDelete(ctx context.Context, username string, encodedId 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 + "/snippets/{username}/{encoded_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* SnippetsApiService + Retrieves a single snippet. Snippets support multiple content types: * application/json * multipart/related * multipart/form-data application/json ---------------- The default content type of the response is `application/json`. Since JSON is always `utf-8`, it cannot reliably contain file contents for files that are not text. Therefore, JSON snippet documents only contain the filename and links to the file contents. This means that in order to retrieve all parts of a snippet, N+1 requests need to be made (where N is the number of files in the snippet). multipart/related ----------------- To retrieve an entire snippet in a single response, use the `Accept: multipart/related` HTTP request header. $ curl -H \"Accept: multipart/related\" https://api.bitbucket.org/2.0/snippets/evzijst/1 Response: HTTP/1.1 200 OK Content-Length: 2214 Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\" MIME-Version: 1.0 --===============1438169132528273974== Content-Type: application/json; charset=\"utf-8\" MIME-Version: 1.0 Content-ID: snippet { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj\" }, \"html\": { \"href\": \"https://bitbucket.org/snippets/evzijst/kypj\" }, \"comments\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/comments\" }, \"watchers\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/watchers\" }, \"commits\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/commits\" } }, \"id\": kypj, \"title\": \"My snippet\", \"created_on\": \"2014-12-29T22:22:04.790331+00:00\", \"updated_on\": \"2014-12-29T22:22:04.790331+00:00\", \"is_private\": false, \"files\": { \"foo.txt\": { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/files/367ab19/foo.txt\" }, \"html\": { \"href\": \"https://bitbucket.org/snippets/evzijst/kypj#file-foo.txt\" } } }, \"image.png\": { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/snippets/evzijst/kypj/files/367ab19/image.png\" }, \"html\": { \"href\": \"https://bitbucket.org/snippets/evzijst/kypj#file-image.png\" } } } ], \"owner\": { \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\" }, \"html\": { \"href\": \"https://bitbucket.org/evzijst\" }, \"avatar\": { \"href\": \"https://bitbucket-staging-assetroot.s3.amazonaws.com/c/photos/2013/Jul/31/erik-avatar-725122544-0_avatar.png\" } } }, \"creator\": { \"username\": \"evzijst\", \"display_name\": \"Erik van Zijst\", \"uuid\": \"{d301aafa-d676-4ee0-88be-962be7417567}\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/evzijst\" }, \"html\": { \"href\": \"https://bitbucket.org/evzijst\" }, \"avatar\": { \"href\": \"https://bitbucket-staging-assetroot.s3.amazonaws.com/c/photos/2013/Jul/31/erik-avatar-725122544-0_avatar.png\" } } } } --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"foo.txt\" Content-Disposition: attachment; filename=\"foo.txt\" foo --===============1438169132528273974== Content-Type: image/png MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-ID: \"image.png\" Content-Disposition: attachment; filename=\"image.png\" iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5 EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg== --===============1438169132528273974==-- multipart/form-data ------------------- As with creating new snippets, `multipart/form-data` can be used as an alternative to `multipart/related`. However, the inherently flat structure of form-data means that only basic, root-level properties can be returned, while nested elements like `links` are omitted: $ curl -H \"Accept: multipart/form-data\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj Response: HTTP/1.1 200 OK Content-Length: 951 Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"title\" Content-Type: text/plain; charset=\"utf-8\" My snippet ------------------------------63a4b224c59f-- Content-Disposition: attachment; name=\"file\"; filename=\"foo.txt\" Content-Type: text/plain foo ------------------------------63a4b224c59f Content-Disposition: attachment; name=\"file\"; filename=\"image.png\" Content-Transfer-Encoding: base64 Content-Type: application/octet-stream iVBORw0KGgoAAAANSUhEUgAAABQAAAAoCAYAAAD+MdrbAAABD0lEQVR4Ae3VMUoDQRTG8ccUaW2m TKONFxArJYJamCvkCnZTaa+VnQdJSBFl2SMsLFrEWNjZBZs0JgiL/+KrhhVmJRbCLPx4O+/DT2TB cbblJxf+UWFVVRNsEGAtgvJxnLm2H+A5RQ93uIl+3632PZyl/skjfOn9Gvdwmlcw5aPUwimG+NT5 EnNN036IaZePUuIcK533NVfal7/5yjWeot2z9ta1cAczHEf7I+3J0ws9Cgx0fsOFpmlfwKcWPuBQ 73Oc4FHzBaZ8llq4q1mr5B2mOUCt815qYR8eB1hG2VJ7j35q4RofaH7IG+Xrf/PfJhfmwtfFYoIN AqxFUD6OMxcvkO+UfKfkOyXfKdsv/AYCHMLVkHAFWgAAAABJRU5ErkJggg== ------------------------------5957323a6b76-- + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet's id. + @return Snippet*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdGet(ctx context.Context, username string, encodedId string) (Snippet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Snippet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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", + "multipart/related", + "multipart/form-data", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Deletes the snippet. Note that this only works for versioned URLs that point to the latest commit of the snippet. Pointing to an older commit results in a 405 status code. To delete a snippet, regardless of whether or not concurrent changes are being made to it, use `DELETE /snippets/{encoded_id}` instead. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param nodeId + @param encodedId The snippet's id. + @return */ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdNodeIdDelete(ctx context.Context, username string, nodeId string, encodedId 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 + "/snippets/{username}/{encoded_id}/{node_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node_id"+"}", fmt.Sprintf("%v", nodeId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* SnippetsApiService + Retrieves the raw contents of a specific file in the snippet. The `Content-Disposition` header will be \"attachment\" to avoid issues with malevolent executable files. The file's mime type is derived from its filename and returned in the `Content-Type` header. Note that for text files, no character encoding is included as part of the content type. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param path + @param nodeId + @param encodedId + @return */ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdNodeIdFilesPathGet(ctx context.Context, username string, path string, nodeId string, encodedId 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 + "/snippets/{username}/{encoded_id}/{node_id}/files/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node_id"+"}", fmt.Sprintf("%v", nodeId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* SnippetsApiService + Identical to `GET /snippets/encoded_id`, except that this endpoint can be used to retrieve the contents of the snippet as it was at an older revision, while `/snippets/encoded_id` always returns the snippet's current revision. Note that only the snippet's file contents are versioned, not its meta data properties like the title. Other than that, the two endpoints are identical in behavior. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet's id. + @param nodeId A commit revision (SHA1). + @return Snippet*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdNodeIdGet(ctx context.Context, username string, encodedId string, nodeId string) (Snippet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Snippet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/{node_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node_id"+"}", fmt.Sprintf("%v", nodeId), -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", + "multipart/related", + "multipart/form-data", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Identical to `UPDATE /snippets/encoded_id`, except that this endpoint takes an explicit commit revision. Only the snippet's \"HEAD\"/\"tip\" (most recent) version can be updated and requests on all other, older revisions fail by returning a 405 status. Usage of this endpoint over the unrestricted `/snippets/encoded_id` could be desired if the caller wants to be sure no concurrent modifications have taken place between the moment of the UPDATE request and the original GET. This can be considered a so-called \"Compare And Swap\", or CAS operation. Other than that, the two endpoints are identical in behavior. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet's id. + @param nodeId A commit revision (SHA1). + @return Snippet*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdNodeIdPut(ctx context.Context, username string, encodedId string, nodeId string) (Snippet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Snippet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/{node_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node_id"+"}", fmt.Sprintf("%v", nodeId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "multipart/related", "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", + "multipart/related", + "multipart/form-data", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Used to update a snippet. Use this to add and delete files and to change a snippet's title. To update a snippet, one can either PUT a full snapshot, or only the parts that need to be changed. The contract for PUT on this API is that properties missing from the request remain untouched so that snippets can be efficiently manipulated with differential payloads. To delete a property (e.g. the title, or a file), include its name in the request, but omit its value (use `null`). As in Git, explicit renaming of files is not supported. Instead, to rename a file, delete it and add it again under another name. This can be done atomically in a single request. Rename detection is left to the SCM. PUT supports three different content types for both request and response bodies: * `application/json` * `multipart/related` * `multipart/form-data` The content type used for the request body can be different than that used for the response. Content types are specified using standard HTTP headers. Use the `Content-Type` and `Accept` headers to select the desired request and response format. application/json ---------------- As with creation and retrieval, the content type determines what properties can be manipulated. `application/json` does not support file contents and is therefore limited to a snippet's meta data. To update the title, without changing any of its files: $ curl -X POST -H \"Content-Type: application/json\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj -d '{\"title\": \"Updated title\"}' To delete the title: $ curl -X POST -H \"Content-Type: application/json\" https://api.bitbucket.org/2.0/snippets/evzijst/kypj -d '{\"title\": null}' Not all parts of a snippet can be manipulated. The owner and creator for instance are immutable. multipart/related ----------------- `multipart/related` can be used to manipulate all of a snippet's properties. The body is identical to a POST. properties omitted from the request are left unchanged. Since the `start` part contains JSON, the mechanism for manipulating the snippet's meta data is identical to `application/json` requests. To update one of a snippet's file contents, while also changing its title: PUT /2.0/snippets/evzijst/kypj HTTP/1.1 Content-Length: 288 Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\" MIME-Version: 1.0 --===============1438169132528273974== Content-Type: application/json; charset=\"utf-8\" MIME-Version: 1.0 Content-ID: snippet { \"title\": \"My updated snippet\", \"files\": { \"foo.txt\": {} } } --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"foo.txt\" Content-Disposition: attachment; filename=\"foo.txt\" Updated file contents. --===============1438169132528273974==-- Here only the parts that are changed are included in the body. The other files remain untouched. Note the use of the `files` list in the JSON part. This list contains the files that are being manipulated. This list should have corresponding multiparts in the request that contain the new contents of these files. If a filename in the `files` list does not have a corresponding part, it will be deleted from the snippet, as shown below: PUT /2.0/snippets/evzijst/kypj HTTP/1.1 Content-Length: 188 Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\" MIME-Version: 1.0 --===============1438169132528273974== Content-Type: application/json; charset=\"utf-8\" MIME-Version: 1.0 Content-ID: snippet { \"files\": { \"image.png\": {} } } --===============1438169132528273974==-- To simulate a rename, delete a file and add the same file under another name: PUT /2.0/snippets/evzijst/kypj HTTP/1.1 Content-Length: 212 Content-Type: multipart/related; start=\"snippet\"; boundary=\"===============1438169132528273974==\" MIME-Version: 1.0 --===============1438169132528273974== Content-Type: application/json; charset=\"utf-8\" MIME-Version: 1.0 Content-ID: snippet { \"files\": { \"foo.txt\": {}, \"bar.txt\": {} } } --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"bar.txt\" Content-Disposition: attachment; filename=\"bar.txt\" foo --===============1438169132528273974==-- multipart/form-data ----------------- Again, one can also use `multipart/form-data` to manipulate file contents and meta data atomically. $ curl -X PUT http://localhost:12345/2.0/snippets/evzijst/kypj -F title=\"My updated snippet\" -F file=@foo.txt PUT /2.0/snippets/evzijst/kypj HTTP/1.1 Content-Length: 351 Content-Type: multipart/form-data; boundary=----------------------------63a4b224c59f ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"file\"; filename=\"foo.txt\" Content-Type: text/plain foo ------------------------------63a4b224c59f Content-Disposition: form-data; name=\"title\" My updated snippet ------------------------------63a4b224c59f To delete a file, omit its contents while including its name in the `files` field: $ curl -X PUT https://api.bitbucket.org/2.0/snippets/evzijst/kypj -F files=image.png PUT /2.0/snippets/evzijst/kypj HTTP/1.1 Content-Length: 149 Content-Type: multipart/form-data; boundary=----------------------------ef8871065a86 ------------------------------ef8871065a86 Content-Disposition: form-data; name=\"files\" image.png ------------------------------ef8871065a86-- The explicit use of the `files` element in `multipart/related` and `multipart/form-data` is only required when deleting files. The default mode of operation is for file parts to be processed, regardless of whether or not they are listed in `files`, as a convenience to the client. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet's id. + @return Snippet*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdPut(ctx context.Context, username string, encodedId string) (Snippet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Snippet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "multipart/related", "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", + "multipart/related", + "multipart/form-data", + } + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Returns the diff of the specified commit against its first parent. Note that this resource is different in functionality from the `patch` resource. The differences between a diff and a patch are: * patches have a commit header with the username, message, etc * diffs support the optional `path=foo/bar.py` query param to filter the diff to just that one file diff (not supported for patches) * for a merge, the diff will show the diff between the merge commit and its first parent (identical to how PRs work), while patch returns a response containing separate patches for each commit on the second parent's ancestry, up to the oldest common ancestor (identical to its reachability). Note that the character encoding of the contents of the diff is unspecified as Git and Mercurial do not track this, making it hard for Bitbucket to reliably determine this. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet id. + @param revision A revspec expression. This can simply be a commit SHA1, a ref name, or a compare expression like `staging..production`. + @param optional (nil or map[string]interface{}) with one or more of: + @param "path" (string) When used, only one the diff of the specified file will be returned. + @return */ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdRevisionDiffGet(ctx context.Context, username string, encodedId string, revision string, localVarOptionals map[string]interface{}) ( *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/{revision}/diff" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"revision"+"}", fmt.Sprintf("%v", revision), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["path"], "string", "path"); err != nil { + return nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["path"].(string); localVarOk { + localVarQueryParams.Add("path", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* SnippetsApiService + Returns the patch of the specified commit against its first parent. Note that this resource is different in functionality from the `diff` resource. The differences between a diff and a patch are: * patches have a commit header with the username, message, etc * diffs support the optional `path=foo/bar.py` query param to filter the diff to just that one file diff (not supported for patches) * for a merge, the diff will show the diff between the merge commit and its first parent (identical to how PRs work), while patch returns a response containing separate patches for each commit on the second parent's ancestry, up to the oldest common ancestor (identical to its reachability). Note that the character encoding of the contents of the patch is unspecified as Git and Mercurial do not track this, making it hard for Bitbucket to reliably determine this. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet id. + @param revision A revspec expression. This can simply be a commit SHA1, a ref name, or a compare expression like `staging..production`. + @return */ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdRevisionPatchGet(ctx context.Context, username string, encodedId string, revision 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 + "/snippets/{username}/{encoded_id}/{revision}/patch" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -1) + localVarPath = strings.Replace(localVarPath, "{"+"revision"+"}", fmt.Sprintf("%v", revision), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* SnippetsApiService + Used to stop watching a specific snippet. Returns 204 (No Content) to indicate success. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet id. + @return PaginatedUsers*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdWatchDelete(ctx context.Context, username string, encodedId string) (PaginatedUsers, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Delete") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedUsers + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/watch" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Used to check if the current user is watching a specific snippet. Returns 204 (No Content) if the user is watching the snippet and 404 if not. Hitting this endpoint anonymously always returns a 404. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet id. + @return PaginatedUsers*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdWatchGet(ctx context.Context, username string, encodedId string) (PaginatedUsers, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedUsers + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/watch" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Used to start watching a specific snippet. Returns 204 (No Content). + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet id. + @return PaginatedUsers*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdWatchPut(ctx context.Context, username string, encodedId string) (PaginatedUsers, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedUsers + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/watch" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Returns a paginated list of all users watching a specific snippet. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param encodedId The snippet id. + @return PaginatedUsers*/ +func (a *SnippetsApiService) SnippetsUsernameEncodedIdWatchersGet(ctx context.Context, username string, encodedId string) (PaginatedUsers, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedUsers + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}/{encoded_id}/watchers" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"encoded_id"+"}", fmt.Sprintf("%v", encodedId), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Identical to `/snippets`, except that the result is further filtered by the snippet owner and only those that are owned by `{username}` are returned. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username Limits the result to snippets owned by this user. + @param optional (nil or map[string]interface{}) with one or more of: + @param "role" (string) Filter down the result based on the authenticated user's role (`owner`, `contributor`, or `member`). + @return PaginatedSnippets*/ +func (a *SnippetsApiService) SnippetsUsernameGet(ctx context.Context, username string, localVarOptionals map[string]interface{}) (PaginatedSnippets, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedSnippets + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["role"], "string", "role"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["role"].(string); localVarOk { + localVarQueryParams.Add("role", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SnippetsApiService + Identical to `/snippets`, except that the new snippet will be created under the account specified in the path parameter `{username}`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param body The new snippet object. + @return Snippet*/ +func (a *SnippetsApiService) SnippetsUsernamePost(ctx context.Context, username string, body Snippet) (Snippet, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Snippet + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/snippets/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/source_api.go b/source_api.go new file mode 100644 index 0000000..7c3459e --- /dev/null +++ b/source_api.go @@ -0,0 +1,443 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type SourceApiService service + + +/* SourceApiService + Returns a paginated list of commits that modified the specified file. Commits are returned in reverse chronological order. This is roughly equivalent to the following commands: $ git log --follow --date-order <sha> <path> $ hg log --follow <path> By default, Bitbucket will follow renames and the path name in the returned entries reflects that. This can be turned off using the `?renames=false` query parameter. Results are returned in descending chronological order by default, and like most endpoints you can [filter and sort](../../../../../../meta/filtering) the response to only provide exactly the data you want. For example, if you wanted to find commits made before 2011-05-18 against a file named `README.rst`, but you only wanted the path and date, your query would look like this: ``` $ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\\ '?fields=values.next,values.path,values.commit.date&q=commit.date<=2011-05-18' { \"values\": [ { \"commit\": { \"date\": \"2011-05-17T07:32:09+00:00\" }, \"path\": \"README.rst\" }, { \"commit\": { \"date\": \"2011-05-16T06:33:28+00:00\" }, \"path\": \"README.txt\" }, { \"commit\": { \"date\": \"2011-05-16T06:15:39+00:00\" }, \"path\": \"README.txt\" } ] } ``` In the response you can see that the file was renamed to `README.rst` by the commit made on 2011-05-16, and was previously named `README.txt`. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param node + @param path + @param repoSlug + @param optional (nil or map[string]interface{}) with one or more of: + @param "renames" (string) When `true`, Bitbucket will follow the history of the file across renames (this is the default behavior). This can be turned off by specifying `false`. + @param "q" (string) Query string to narrow down the response as per [filtering and sorting](../../../../../../meta/filtering). + @param "sort" (string) Name of a response property sort the result by as per [filtering and sorting](../../../../../../meta/filtering#query-sort). + @return PaginatedFiles*/ +func (a *SourceApiService) RepositoriesUsernameRepoSlugFilehistoryNodePathGet(ctx context.Context, username string, node string, path string, repoSlug string, localVarOptionals map[string]interface{}) (PaginatedFiles, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedFiles + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/filehistory/{node}/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["renames"], "string", "renames"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["q"], "string", "q"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sort"], "string", "sort"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["renames"].(string); localVarOk { + localVarQueryParams.Add("renames", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["q"].(string); localVarOk { + localVarQueryParams.Add("q", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sort"].(string); localVarOk { + localVarQueryParams.Add("sort", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SourceApiService + This endpoint redirects the client to the directory listing of the root directory on the main branch. This is equivalent to directly hitting [/2.0/repositories/{username}/{repo_slug}/src/{node}/{path}](src/%7Bnode%7D/%7Bpath%7D) without having to know the name or SHA1 of the repo's main branch. To create new commits, [POST to this endpoint](#post) + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param optional (nil or map[string]interface{}) with one or more of: + @param "format" (string) Instead of returning the file's contents, return the (json) meta data for it. + @return PaginatedTreeentries*/ +func (a *SourceApiService) RepositoriesUsernameRepoSlugSrcGet(ctx context.Context, username string, repoSlug string, localVarOptionals map[string]interface{}) (PaginatedTreeentries, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedTreeentries + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/src" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["format"], "string", "format"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["format"].(string); localVarOk { + localVarQueryParams.Add("format", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SourceApiService + This endpoints is used to retrieve the contents of a single file, or the contents of a directory at a specified revision. ## Raw file contents When `path` points to a file, this endpoint returns the raw contents. The response's Content-Type is derived from the filename extension (not from the contents). The file contents are not processed and no character encoding/recoding is performed and as a result no character encoding is included as part of the Content-Type. The `Content-Disposition` header will be \"attachment\" to prevent browsers from running executable files. If the file is managed by LFS, then a 301 redirect pointing to Atlassian's media services platform is returned. The response includes an ETag that is based on the contents of the file and its attributes. This means that an empty `__init__.py` always returns the same ETag, regardless on the directory it lives in, or the commit it is on. ## File meta data When the request for a file path includes the query parameter `?format=meta`, instead of returning the file's raw contents, Bitbucket instead returns the JSON object describing the file's properties: ```javascript $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests/__init__.py?format=meta { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\" } }, \"path\": \"tests/__init__.py\", \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } }, \"attributes\": [], \"type\": \"commit_file\", \"size\": 0 } ``` File objects contain an `attributes` element that contains a list of possible modifiers. Currently defined values are: * `link` -- indicates that the entry is a symbolic link. The contents of the file represent the path the link points to. * `executable` -- indicates that the file has the executable bit set. * `subrepository` -- indicates that the entry points to a submodule or subrepo. The contents of the file is the SHA1 of the repository pointed to. * `binary` -- indicates whether Bitbucket thinks the file is binary. This endpoint can provide an alternative to how a HEAD request can be used to check for the existence of a file, or a file's size without incurring the overhead of receiving its full contents. ## Directory listings When `path` points to a directory instead of a file, the response is a paginated list of directory and file objects in the same order as the underlying SCM system would return them. For example: ```javascript $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests { \"pagelen\": 10, \"values\": [ { \"path\": \"tests/test_project\", \"type\": \"commit_directory\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\" } }, \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } } }, { \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\" } }, \"path\": \"tests/__init__.py\", \"commit\": { \"type\": \"commit\", \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\" }, \"html\": { \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\" } } }, \"attributes\": [], \"type\": \"commit_file\", \"size\": 0 } ], \"page\": 1, \"size\": 2 } ``` When listing the contents of the repo's root directory, the use of a trailing slash at the end of the URL is required. The response is not recursive, meaning that only the direct contents of a path are returned. The response does not recurse down into subdirectories. In order to \"walk\" the entire directory tree, the client needs to parse each response and follow the `self` links of each `commit_directory` object. Each returned object is either a `commit_file`, or a `commit_directory`, both of which contain a `path` element. This path is the absolute path from the root of the repository. Each object also contains a `commit` object which embeds the commit the file is on. Note that this is merely the commit that was used in the URL. It is *not* the commit that last modified the file. Directory objects have 2 representations. Their `self` link returns the paginated contents of the directory. The `meta` link on the other hand returns the actual `directory` object itself, e.g.: ```javascript { \"path\": \"tests/test_project\", \"type\": \"commit_directory\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\" }, \"meta\": { \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\" } }, \"commit\": { ... } } ``` ## Querying, filtering and sorting Like most API endpoints, this API supports the Bitbucket querying/filtering syntax and so you could filter a directory listing to only include entries that match certain criteria. For instance, to list all binary files over 1kb use the expression: `size > 1024 and attributes = \"binary\"` which after urlencoding yields the query string: `?q=size%3E1024+and+attributes%3D%22binary%22` To change the ordering of the response, use the `?sort` parameter: `.../src/eefd5ef/?sort=-size` See [filtering and sorting](../../../../../../meta/filtering) for more details. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param node + @param path + @param repoSlug + @param optional (nil or map[string]interface{}) with one or more of: + @param "format" (string) If 'meta' is provided, returns the (json) meta data for the contents of the file. If 'rendered' is provided, returns the contents of a non-binary file in HTML-formatted rendered markup. Since Git and Mercurial do not generally track what text encoding scheme is used, this endpoint attempts to detect the most appropriate character encoding. While usually correct, determining the character encoding can be ambiguous which in exceptional cases can lead to misinterpretation of the characters. As such, the raw element in the response object should not be treated as equivalent to the file's actual contents. + @param "q" (string) Optional filter expression as per [filtering and sorting](../../../../../../meta/filtering). + @param "sort" (string) Optional sorting parameter as per [filtering and sorting](../../../../../../meta/filtering#query-sort). + @return PaginatedTreeentries*/ +func (a *SourceApiService) RepositoriesUsernameRepoSlugSrcNodePathGet(ctx context.Context, username string, node string, path string, repoSlug string, localVarOptionals map[string]interface{}) (PaginatedTreeentries, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedTreeentries + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/src/{node}/{path}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"node"+"}", fmt.Sprintf("%v", node), -1) + localVarPath = strings.Replace(localVarPath, "{"+"path"+"}", fmt.Sprintf("%v", path), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["format"], "string", "format"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["q"], "string", "q"); err != nil { + return successPayload, nil, err + } + if err := typeCheckParameter(localVarOptionals["sort"], "string", "sort"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["format"].(string); localVarOk { + localVarQueryParams.Add("format", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["q"].(string); localVarOk { + localVarQueryParams.Add("q", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["sort"].(string); localVarOk { + localVarQueryParams.Add("sort", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SourceApiService + This endpoint is used to create new commits in the repository by uploading files. To add a new file to a repository: ``` $ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \\ -F /repo/path/to/image.png=@image.png ``` This will create a new commit on top of the main branch, inheriting the contents of the main branch, but adding (or overwriting) the `image.png` file to the repository in the `/repo/path/to` directory. This endpoint accepts `multipart/form-data` (as in the example above), as well as `application/x-www-form-urlencoded`. ## multipart/form-data A `multipart/form-data` post contains a series of \"form fields\" that identify both the individual files that are being uploaded, as well as additional, optional meta data. Files are uploaded in file form fields (those that have a `Content-Disposition` parameter) whose field names point to the remote path in the repository where the file should be stored. Path field names are always interpreted to be absolute from the root of the repository, regardless whether the client uses a leading slash (as the above `curl` example did). File contents are treated as bytes and are not decoded as text. The commit message, as well as other non-file meta data for the request, is sent along as normal form field elements. Meta data fields share the same namespace as the file objects. For `multipart/form-data` bodies that should not lead to any ambiguity, as the `Content-Disposition` header will contain the `filename` parameter to distinguish between a file named \"message\" and the commit message field. ## application/x-www-form-urlencoded It is also possible to upload new files using a simple `application/x-www-form-urlencoded` POST. This can be convenient when uploading pure text files: ``` $ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/ \\ --data-urlencode \"/path/to/me.txt=Lorem ipsum.\" \\ --data-urlencode \"message=Initial commit\" \\ --data-urlencode \"author=Erik van Zijst <erik.van.zijst@gmail.com>\" ``` There could be a field name clash if a client were to upload a file named \"message\", as this filename clashes with the meta data property for the commit message. To avoid this and to upload files whose names clash with the meta data properties, use a leading slash for the files, e.g. `curl --data-urlencode \"/message=file contents\"`. When an explicit slash is omitted for a file whose path matches that of a meta data parameter, then it is interpreted as meta data, not as a file. ## Executables and links While this API aims to facilitate the most common use cases, it is possible to perform some more advanced operations like creating a new symlink in the repository, or creating an executable file. Files can be supplied with a `x-attributes` value in the `Content-Disposition` header. For example, to upload an executable file, as well as create a symlink from `README.txt` to `README`: ``` --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"bin/shutdown.sh\" Content-Disposition: attachment; filename=\"shutdown.sh\"; x-attributes:\"executable\" #!/bin/sh halt --===============1438169132528273974== Content-Type: text/plain; charset=\"us-ascii\" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-ID: \"/README.txt\" Content-Disposition: attachment; filename=\"README.txt\"; x-attributes:\"link\" README --===============1438169132528273974==-- ``` Links are files that contain the target path and have `x-attributes:\"link\"` set. When overwriting links with files, or vice versa, the newly uploaded file determines both the new contents, as well as the attributes. That means uploading a file without specifying `x-attributes=\"link\"` will create a regular file, even if the parent commit hosted a symlink at the same path. The same applies to executables. When modifying an existing executable file, the form-data file element must include `x-attributes=\"executable\"` in order to preserve the executable status of the file. Note that this API does not support the creation or manipulation of subrepos / submodules. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param optional (nil or map[string]interface{}) with one or more of: + @param "message" (string) The commit message. When omitted, Bitbucket uses a canned string. + @param "author" (string) The raw string to be used as the new commit's author. This string follows the format `Erik van Zijst <evzijst@atlassian.com>`. When omitted, Bitbucket uses the authenticated user's full/display name and primary email address. Commits cannot be created anonymously. + @param "parents" (string) A comma-separated list of SHA1s of the commits that should be the parents of the newly created commit. When omitted, the new commit will inherit from and become a child of the main branch's tip/HEAD commit. When more than one SHA1 is provided, the first SHA1 identifies the commit from which the content will be inherited. When more than 2 parents are provided on a Mercurial repo, a 400 is returned as Mercurial does not support \"octopus merges\". + @param "files" (string) Optional field that declares the files that the request is manipulating. When adding a new file to a repo, or when overwriting an existing file, the client can just upload the full contents of the file in a normal form field and the use of this `files` meta data field is redundant. However, when the `files` field contains a file path that does not have a corresponding, identically-named form field, then Bitbucket interprets that as the client wanting to replace the named file with the null set and the file is deleted instead. Paths in the repo that are referenced in neither files nor an individual file field, remain unchanged and carry over from the parent to the new commit. This API does not support renaming as an explicit feature. To rename a file, simply delete it and recreate it under the new name in the same commit. + @param "files2" (string) The name of the branch that the new commit should be created on. When omitted, the commit will be created on top of the main branch and will become the main branch's new HEAD/tip. When a branch name is provided that already exists in the repo, then the commit will be created on top of that branch. In this case, if a parent SHA1 was also provided, then it is asserted that the parent is the branch's tip/HEAD at the time the request is made. When this is not the case, a 409 is returned. This API cannot be used to create new anonymous heads in Mercurial repos. When a new branch name is specified (that does not already exist in the repo), and no parent SHA1s are provided, then the new commit will inherit from the current main branch's tip/HEAD commit, but not advance the main branch. The new commit will be the new branch. When the request also specifies a parent SHA1, then the new commit and branch are created directly on top of the parent commit, regardless of the state of the main branch. When a branch name is not specified, but a parent SHA1 is provided, then Bitbucket asserts that it represents the main branch's current HEAD/tip, or a 409 is returned. When a branch name is not specified and the repo is empty, the new commit will become the repo's root commit and will be on the main branch. When a branch name is specified and the repo is empty, the new commit will become the repo's root commit and also define the repo's main branch going forward. This API cannot be used to create additional root commits in non-empty repos. The branch field cannot be repeated. As a side effect, this API can be used to create a new branch without modifying any files, by specifying a new branch name in this field, together with parents, but omitting the files fields, while not sending any files. This will create a new commit and branch with the same contents as the first parent. The diff of this commit against its first parent will be empty. + @param "branch" (string) The name of the branch that the new commit should be created on. When omitted, the commit will be created on top of the main branch and will become the main branch's new head. When a branch name is provided that already exists in the repo, then the commit will be created on top of that branch. In this case, *if* a parent SHA1 was also provided, then it is asserted that the parent is the branch's tip/HEAD at the time the request is made. When this is not the case, a 409 is returned. This API cannot be used to create new anonymous heads in Mercurial repositories. When a new branch name is specified (that does not already exist in the repo), and no parent SHA1s are provided, then the new commit will inherit from the current main branch's tip/HEAD commit, but not advance the main branch. The new commit will be the new branch. When the request *also* specifies a parent SHA1, then the new commit and branch are created directly on top of the parent commit, regardless of the state of the main branch. When a branch name is not specified, but a parent SHA1 is provided, then Bitbucket asserts that it represents the main branch's current HEAD/tip, or a 409 is returned. When a branch name is not specified and the repo is empty, the new commit will become the repo's root commit and will be on the main branch. When a branch name is specified and the repo is empty, the new commit will become the repo's root commit and also define the repo's main branch going forward. This API cannot be used to create additional root commits in non-empty repos. The branch field cannot be repeated. As a side effect, this API can be used to create a new branch without modifying any files, by specifying a new branch name in this field, together with `parents`, but omitting the `files` fields, while not sending any files. This will create a new commit and branch with the same contents as the first parent. The diff of this commit against its first parent will be empty. + @return */ +func (a *SourceApiService) RepositoriesUsernameRepoSlugSrcPost(ctx context.Context, username string, repoSlug string, localVarOptionals map[string]interface{}) ( *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/src" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["message"], "string", "message"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["author"], "string", "author"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["parents"], "string", "parents"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["files"], "string", "files"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["files2"], "string", "files2"); err != nil { + return nil, err + } + if err := typeCheckParameter(localVarOptionals["branch"], "string", "branch"); err != nil { + return nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["message"].(string); localVarOk { + localVarQueryParams.Add("message", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["author"].(string); localVarOk { + localVarQueryParams.Add("author", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["parents"].(string); localVarOk { + localVarQueryParams.Add("parents", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["files"].(string); localVarOk { + localVarQueryParams.Add("files", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["files2"].(string); localVarOk { + localVarQueryParams.Add("files", parameterToString(localVarTempParam, "")) + } + if localVarTempParam, localVarOk := localVarOptionals["branch"].(string); localVarOk { + localVarQueryParams.Add("branch", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + diff --git a/ssh_account_key.go b/ssh_account_key.go new file mode 100644 index 0000000..15bdb8e --- /dev/null +++ b/ssh_account_key.go @@ -0,0 +1,40 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type SshAccountKey struct { + + Type_ string `json:"type"` + + // The SSH key's immutable ID. + Uuid string `json:"uuid,omitempty"` + + // The SSH public key value in OpenSSH format. + Key string `json:"key,omitempty"` + + // The comment parsed from the SSH key (if present) + Comment string `json:"comment,omitempty"` + + // The user-defined label for the SSH key + Label string `json:"label,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + LastUsed time.Time `json:"last_used,omitempty"` + + Links *MilestoneLinks `json:"links,omitempty"` + + Owner *Account `json:"owner,omitempty"` +} diff --git a/ssh_api.go b/ssh_api.go new file mode 100644 index 0000000..3aad05b --- /dev/null +++ b/ssh_api.go @@ -0,0 +1,427 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type SshApiService service + + +/* SshApiService + Deletes a specific SSH public key from a user's account Example: ``` $ curl -X DELETE https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a} ``` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account's username or UUID. + @param keyId The SSH key's UUID value. + @return */ +func (a *SshApiService) UsersUsernameSshKeysDelete(ctx context.Context, username 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 + "/users/{username}/ssh-keys/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key_id"+"}", 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* SshApiService + Returns a specific SSH public key belonging to a user. Example: ``` $ curl https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/{fbe4bbab-f6f7-4dde-956b-5c58323c54b3} { \"comment\": \"user@myhost\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ``` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account's username or UUID. + @param keyId The SSH key's UUID value. + @return SshAccountKey*/ +func (a *SshApiService) UsersUsernameSshKeysGet(ctx context.Context, username string, keyId string) (SshAccountKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload SshAccountKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/ssh-keys/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key_id"+"}", 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SshApiService + Returns a paginated list of the user's SSH public keys. Example: ``` $ curl https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys { \"page\": 1, \"pagelen\": 10, \"size\": 1, \"values\": [ { \"comment\": \"user@myhost\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ] } ``` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account's username or UUID. + @return PaginatedSshUserKeys*/ +func (a *SshApiService) UsersUsernameSshKeysGet_1(ctx context.Context, username string) (PaginatedSshUserKeys, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedSshUserKeys + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/ssh-keys" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SshApiService + Adds a new SSH public key to the specified user account and returns the resulting key. Example: ``` $ curl -X POST -H \"Content-Type: application/json\" -d '{\"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY user@myhost\"}' https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys { \"comment\": \"user@myhost\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ``` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account's username or UUID. + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (SshAccountKey) The new SSH key object + @return SshAccountKey*/ +func (a *SshApiService) UsersUsernameSshKeysPost(ctx context.Context, username string, localVarOptionals map[string]interface{}) (SshAccountKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload SshAccountKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/ssh-keys" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 localVarTempParam, localVarOk := localVarOptionals["body"].(SshAccountKey); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* SshApiService + Updates a specific SSH public key on a user's account Note: Only the 'comment' field can be updated using this API. To modify the key or comment values, you must delete and add the key again. Example: ``` $ curl -X PUT -H \"Content-Type: application/json\" -d '{\"label\": \"Work key\"}' https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/{b15b6026-9c02-4626-b4ad-b905f99f763a} { \"comment\": \"\", \"created_on\": \"2018-03-14T13:17:05.196003+00:00\", \"key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqP3Cr632C2dNhhgKVcon4ldUSAeKiku2yP9O9/bDtY\", \"label\": \"Work key\", \"last_used\": \"2018-03-20T13:18:05.196003+00:00\", \"links\": { \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl/ssh-keys/b15b6026-9c02-4626-b4ad-b905f99f763a\" } }, \"owner\": { \"display_name\": \"Mark Adams\", \"links\": { \"avatar\": { \"href\": \"https://bitbucket.org/account/markadams-atl/avatar/32/\" }, \"html\": { \"href\": \"https://bitbucket.org/markadams-atl/\" }, \"self\": { \"href\": \"https://api.bitbucket.org/2.0/users/markadams-atl\" } }, \"type\": \"user\", \"username\": \"markadams-atl\", \"uuid\": \"{d7dd0e2d-3994-4a50-a9ee-d260b6cefdab}\" }, \"type\": \"ssh_key\", \"uuid\": \"{b15b6026-9c02-4626-b4ad-b905f99f763a}\" } ``` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account's username or UUID. + @param keyId The SSH key's UUID value. + @param optional (nil or map[string]interface{}) with one or more of: + @param "body" (SshAccountKey) The updated SSH key object + @return SshAccountKey*/ +func (a *SshApiService) UsersUsernameSshKeysPut(ctx context.Context, username string, keyId string, localVarOptionals map[string]interface{}) (SshAccountKey, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload SshAccountKey + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/ssh-keys/" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key_id"+"}", 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 localVarTempParam, localVarOk := localVarOptionals["body"].(SshAccountKey); localVarOk { + localVarPostBody = &localVarTempParam + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/ssh_key.go b/ssh_key.go new file mode 100644 index 0000000..e7a90c0 --- /dev/null +++ b/ssh_key.go @@ -0,0 +1,38 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type SshKey struct { + + Type_ string `json:"type"` + + // The SSH key's immutable ID. + Uuid string `json:"uuid,omitempty"` + + // The SSH public key value in OpenSSH format. + Key string `json:"key,omitempty"` + + // The comment parsed from the SSH key (if present) + Comment string `json:"comment,omitempty"` + + // The user-defined label for the SSH key + Label string `json:"label,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + LastUsed time.Time `json:"last_used,omitempty"` + + Links *MilestoneLinks `json:"links,omitempty"` +} diff --git a/subject_types.go b/subject_types.go new file mode 100644 index 0000000..cc031fd --- /dev/null +++ b/subject_types.go @@ -0,0 +1,21 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// The mapping of resource/subject types pointing to their individual event types. +type SubjectTypes struct { + + Repository *SubjectTypesRepository `json:"repository,omitempty"` + + User *SubjectTypesRepository `json:"user,omitempty"` + + Team *SubjectTypesRepository `json:"team,omitempty"` +} diff --git a/subject_types_repository.go b/subject_types_repository.go new file mode 100644 index 0000000..5939bcc --- /dev/null +++ b/subject_types_repository.go @@ -0,0 +1,16 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type SubjectTypesRepository struct { + + Events *MilestoneLinksSelf `json:"events,omitempty"` +} diff --git a/tag.go b/tag.go new file mode 100644 index 0000000..a6dc8e5 --- /dev/null +++ b/tag.go @@ -0,0 +1,36 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +// A tag object, representing a tag in a repository. +type Tag struct { + + Type_ string `json:"type"` + + Links *TagLinks `json:"links,omitempty"` + + // The name of the tag. + Name string `json:"name,omitempty"` + + Target *Commit `json:"target,omitempty"` + + // The message associated with the tag, if available. + Message string `json:"message,omitempty"` + + // The date that the tag was created, if available + Date time.Time `json:"date,omitempty"` + + Tagger *Author `json:"tagger,omitempty"` +} diff --git a/tag_links.go b/tag_links.go new file mode 100644 index 0000000..bfa548c --- /dev/null +++ b/tag_links.go @@ -0,0 +1,20 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type TagLinks struct { + + Self *MilestoneLinksSelf `json:"self,omitempty"` + + Commits *MilestoneLinksSelf `json:"commits,omitempty"` + + Html *MilestoneLinksSelf `json:"html,omitempty"` +} diff --git a/team.go b/team.go new file mode 100644 index 0000000..be0be7e --- /dev/null +++ b/team.go @@ -0,0 +1,32 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type Team struct { + + Type_ string `json:"type"` + + Links *AccountLinks `json:"links,omitempty"` + + Username string `json:"username,omitempty"` + + DisplayName string `json:"display_name,omitempty"` + + Website string `json:"website,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + Uuid string `json:"uuid,omitempty"` +} diff --git a/team_permission.go b/team_permission.go new file mode 100644 index 0000000..c8113cd --- /dev/null +++ b/team_permission.go @@ -0,0 +1,23 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// A user's permission for a given team. +type TeamPermission struct { + + Type_ string `json:"type"` + + Permission string `json:"permission,omitempty"` + + User *User `json:"user,omitempty"` + + Team *Team `json:"team,omitempty"` +} diff --git a/teams_api.go b/teams_api.go new file mode 100644 index 0000000..96c81d4 --- /dev/null +++ b/teams_api.go @@ -0,0 +1,960 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type TeamsApiService service + + +/* TeamsApiService + Returns all the teams that the authenticated user is associated with. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param optional (nil or map[string]interface{}) with one or more of: + @param "role" (string) Filters the teams based on the authenticated user's role on each team. * **member**: returns a list of all the teams which the caller is a member of at least one team group or repository owned by the team * **contributor**: returns a list of teams which the caller has write access to at least one repository owned by the team * **admin**: returns a list teams which the caller has team administrator access + @return PaginatedTeams*/ +func (a *TeamsApiService) TeamsGet(ctx context.Context, localVarOptionals map[string]interface{}) (PaginatedTeams, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedTeams + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if err := typeCheckParameter(localVarOptionals["role"], "string", "role"); err != nil { + return successPayload, nil, err + } + + if localVarTempParam, localVarOk := localVarOptionals["role"].(string); localVarOk { + localVarQueryParams.Add("role", parameterToString(localVarTempParam, "")) + } + // 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* TeamsApiService + Returns the list of accounts that are following this team. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The team's username + @return PaginatedUsers*/ +func (a *TeamsApiService) TeamsUsernameFollowersGet(ctx context.Context, username string) (PaginatedUsers, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedUsers + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/followers" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* TeamsApiService + Returns the list of accounts this team is following. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The team's username + @return PaginatedUsers*/ +func (a *TeamsApiService) TeamsUsernameFollowingGet(ctx context.Context, username string) (PaginatedUsers, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedUsers + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/following" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* TeamsApiService + Gets the public information associated with a team. If the team's profile is private, `location`, `website` and `created_on` elements are omitted. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The team's username or UUID. + @return Team*/ +func (a *TeamsApiService) TeamsUsernameGet(ctx context.Context, username string) (Team, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload Team + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* TeamsApiService + Returns a paginated list of webhooks installed on this team. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return PaginatedWebhookSubscriptions*/ +func (a *TeamsApiService) TeamsUsernameHooksGet(ctx context.Context, username string) (PaginatedWebhookSubscriptions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedWebhookSubscriptions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* TeamsApiService + Creates a new webhook on the specified team. Team webhooks are fired for events from all repositories belonging to that team account. Note that only admins can install webhooks on teams. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return WebhookSubscription*/ +func (a *TeamsApiService) TeamsUsernameHooksPost(ctx context.Context, username string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* TeamsApiService + Deletes the specified webhook subscription from the given team account. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id + @return */ +func (a *TeamsApiService) TeamsUsernameHooksUidDelete(ctx context.Context, username string, uid 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 + "/teams/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* TeamsApiService + Returns the webhook with the specified id installed on the given team account. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id. + @return WebhookSubscription*/ +func (a *TeamsApiService) TeamsUsernameHooksUidGet(ctx context.Context, username string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* TeamsApiService + Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id + @return WebhookSubscription*/ +func (a *TeamsApiService) TeamsUsernameHooksUidPut(ctx context.Context, username string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* TeamsApiService + All members of a team. Returns all members of the specified team. Any member of any of the team's groups is considered a member of the team. This includes users in groups that may not actually have access to any of the team's repositories. Note that members using the \"private profile\" feature are not included. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return User*/ +func (a *TeamsApiService) TeamsUsernameMembersGet(ctx context.Context, username string) (User, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/members" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* TeamsApiService + All repositories owned by a user/team. This includes private repositories, but filtered down to the ones that the calling user has access to. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return ModelError*/ +func (a *TeamsApiService) TeamsUsernameRepositoriesGet(ctx context.Context, username string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/repositories" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* TeamsApiService + All repositories owned by a user/team. This includes private repositories, but filtered down to the ones that the calling user has access to. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return ModelError*/ +func (a *TeamsApiService) UsersUsernameRepositoriesGet(ctx context.Context, username string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/repositories" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/treeentry.go b/treeentry.go new file mode 100644 index 0000000..31eb858 --- /dev/null +++ b/treeentry.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +// Base type for most resource objects. It defines the common `type` element that identifies an object's type. It also identifies the element as Swagger's `discriminator`. +type Treeentry struct { + + Type_ string `json:"type"` + + // The path in the repository + Path string `json:"path,omitempty"` + + Commit *Commit `json:"commit,omitempty"` +} diff --git a/user.go b/user.go new file mode 100644 index 0000000..f0d061a --- /dev/null +++ b/user.go @@ -0,0 +1,37 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type User struct { + + Type_ string `json:"type"` + + Links *AccountLinks `json:"links,omitempty"` + + Username string `json:"username,omitempty"` + + DisplayName string `json:"display_name,omitempty"` + + Website string `json:"website,omitempty"` + + CreatedOn time.Time `json:"created_on,omitempty"` + + Uuid string `json:"uuid,omitempty"` + + IsStaff bool `json:"is_staff,omitempty"` + + // The user's Atlassian account ID. + AccountId string `json:"account_id,omitempty"` +} diff --git a/users_api.go b/users_api.go new file mode 100644 index 0000000..e6bf45f --- /dev/null +++ b/users_api.go @@ -0,0 +1,1027 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type UsersApiService service + + +/* UsersApiService + All repositories owned by a user/team. This includes private repositories, but filtered down to the ones that the calling user has access to. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return ModelError*/ +func (a *UsersApiService) TeamsUsernameRepositoriesGet(ctx context.Context, username string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/repositories" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + Returns details about a specific one of the authenticated user's email addresses. Details describe whether the address has been confirmed by the user and whether it is the user's primary address or not. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param email + @return ModelError*/ +func (a *UsersApiService) UserEmailsEmailGet(ctx context.Context, email string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user/emails/{email}" + localVarPath = strings.Replace(localVarPath, "{"+"email"+"}", fmt.Sprintf("%v", email), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + Returns all the authenticated user's email addresses. Both confirmed and unconfirmed. + * @param ctx context.Context for authentication, logging, tracing, etc. + @return ModelError*/ +func (a *UsersApiService) UserEmailsGet(ctx context.Context) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/user/emails" + + 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + Returns the currently logged in user. + * @param ctx context.Context for authentication, logging, tracing, etc. + @return User*/ +func (a *UsersApiService) UserGet(ctx context.Context) (User, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + Returns the list of accounts that are following this team. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account's username + @return PaginatedUsers*/ +func (a *UsersApiService) UsersUsernameFollowersGet(ctx context.Context, username string) (PaginatedUsers, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedUsers + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/followers" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + Returns the list of accounts this user is following. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The user's username + @return PaginatedUsers*/ +func (a *UsersApiService) UsersUsernameFollowingGet(ctx context.Context, username string) (PaginatedUsers, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedUsers + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/following" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + Gets the public information associated with a user account. If the user's profile is private, `location`, `website` and `created_on` elements are omitted. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username The account's username or UUID. + @return User*/ +func (a *UsersApiService) UsersUsernameGet(ctx context.Context, username string) (User, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload User + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + Returns a paginated list of webhooks installed on this user account. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return PaginatedWebhookSubscriptions*/ +func (a *UsersApiService) UsersUsernameHooksGet(ctx context.Context, username string) (PaginatedWebhookSubscriptions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedWebhookSubscriptions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + Creates a new webhook on the specified user account. Account-level webhooks are fired for events from all repositories belonging to that account. Note that one can only register webhooks on one's own account, not that of others. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return WebhookSubscription*/ +func (a *UsersApiService) UsersUsernameHooksPost(ctx context.Context, username string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + Deletes the specified webhook subscription from the given user account. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id + @return */ +func (a *UsersApiService) UsersUsernameHooksUidDelete(ctx context.Context, username string, uid 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 + "/users/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* UsersApiService + Returns the webhook with the specified id installed on the given user account. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id. + @return WebhookSubscription*/ +func (a *UsersApiService) UsersUsernameHooksUidGet(ctx context.Context, username string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id + @return WebhookSubscription*/ +func (a *UsersApiService) UsersUsernameHooksUidPut(ctx context.Context, username string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* UsersApiService + All repositories owned by a user/team. This includes private repositories, but filtered down to the ones that the calling user has access to. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return ModelError*/ +func (a *UsersApiService) UsersUsernameRepositoriesGet(ctx context.Context, username string) (ModelError, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload ModelError + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/repositories" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + diff --git a/version.go b/version.go new file mode 100644 index 0000000..a0ab1ef --- /dev/null +++ b/version.go @@ -0,0 +1,22 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +type Version struct { + + Type_ string `json:"type"` + + Links *MilestoneLinks `json:"links,omitempty"` + + Name string `json:"name,omitempty"` + + Id int32 `json:"id,omitempty"` +} diff --git a/webhook_subscription.go b/webhook_subscription.go new file mode 100644 index 0000000..b7d2987 --- /dev/null +++ b/webhook_subscription.go @@ -0,0 +1,41 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "time" +) + +type WebhookSubscription struct { + + Type_ string `json:"type"` + + // The webhook's id + Uuid string `json:"uuid,omitempty"` + + // The URL events get delivered to. + Url string `json:"url,omitempty"` + + // A user-defined description of the webhook. + Description string `json:"description,omitempty"` + + // The type of entity, which is `repository` in the case of webhook subscriptions on repositories. + SubjectType string `json:"subject_type,omitempty"` + + Subject *interface{} `json:"subject,omitempty"` + + Active bool `json:"active,omitempty"` + + CreatedAt time.Time `json:"created_at,omitempty"` + + // The events this webhook is subscribed to. + Events []string `json:"events,omitempty"` +} diff --git a/webhooks_api.go b/webhooks_api.go new file mode 100644 index 0000000..c174eb9 --- /dev/null +++ b/webhooks_api.go @@ -0,0 +1,1347 @@ +/* + * Bitbucket API + * + * Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework. + * + * API version: 2.0 + * Contact: support@bitbucket.org + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package bitbucket + +import ( + "io/ioutil" + "net/url" + "net/http" + "strings" + "golang.org/x/net/context" + "encoding/json" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type WebhooksApiService service + + +/* WebhooksApiService + Returns the webhook resource or subject types on which webhooks can be registered. Each resource/subject type contains an `events` link that returns the paginated list of specific events each individual subject type can emit. This endpoint is publicly accessible and does not require authentication or scopes. Example: ``` $ curl https://api.bitbucket.org/2.0/hook_events { \"repository\": { \"links\": { \"events\": { \"href\": \"https://api.bitbucket.org/2.0/hook_events/repository\" } } }, \"team\": { \"links\": { \"events\": { \"href\": \"https://api.bitbucket.org/2.0/hook_events/team\" } } }, \"user\": { \"links\": { \"events\": { \"href\": \"https://api.bitbucket.org/2.0/hook_events/user\" } } } } ``` + * @param ctx context.Context for authentication, logging, tracing, etc. + @return SubjectTypes*/ +func (a *WebhooksApiService) HookEventsGet(ctx context.Context) (SubjectTypes, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload SubjectTypes + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/hook_events" + + 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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Returns a paginated list of all valid webhook events for the specified entity. This is public data that does not require any scopes or authentication. Example: NOTE: The following example is a truncated response object for the `team` `subject_type`. We return the same structure for the other `subject_type` objects. ``` $ curl https://api.bitbucket.org/2.0/hook_events/team { \"page\": 1, \"pagelen\": 30, \"size\": 21, \"values\": [ { \"category\": \"Repository\", \"description\": \"Whenever a repository push occurs\", \"event\": \"repo:push\", \"label\": \"Push\" }, { \"category\": \"Repository\", \"description\": \"Whenever a repository fork occurs\", \"event\": \"repo:fork\", \"label\": \"Fork\" }, ... { \"category\": \"Repository\", \"description\": \"Whenever a repository import occurs\", \"event\": \"repo:imported\", \"label\": \"Import\" } ] } ``` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param subjectType A resource or subject type. + @return PaginatedHookEvents*/ +func (a *WebhooksApiService) HookEventsSubjectTypeGet(ctx context.Context, subjectType string) (PaginatedHookEvents, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedHookEvents + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/hook_events/{subject_type}" + localVarPath = strings.Replace(localVarPath, "{"+"subject_type"+"}", fmt.Sprintf("%v", subjectType), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Returns a paginated list of webhooks installed on this repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return PaginatedWebhookSubscriptions*/ +func (a *WebhooksApiService) RepositoriesUsernameRepoSlugHooksGet(ctx context.Context, username string, repoSlug string) (PaginatedWebhookSubscriptions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedWebhookSubscriptions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Creates a new webhook on the specified repository. Example: ``` $ curl -X POST -u credentials -H 'Content-Type: application/json' https://api.bitbucket.org/2.0/repositories/username/slug/hooks -d ' { \"description\": \"Webhook Description\", \"url\": \"https://example.com/\", \"active\": true, \"events\": [ \"repo:push\", \"issue:created\", \"issue:updated\" ] }' ``` Note that this call requires the webhook scope, as well as any scope that applies to the events that the webhook subscribes to. In the example above that means: `webhook`, `repository` and `issue`. Also note that the `url` must properly resolve and cannot be an internal, non-routed address. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @return WebhookSubscription*/ +func (a *WebhooksApiService) RepositoriesUsernameRepoSlugHooksPost(ctx context.Context, username string, repoSlug string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Deletes the specified webhook subscription from the given repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param uid The installed webhook's id + @return */ +func (a *WebhooksApiService) RepositoriesUsernameRepoSlugHooksUidDelete(ctx context.Context, username string, repoSlug string, uid 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 + "/repositories/{username}/{repo_slug}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* WebhooksApiService + Returns the webhook with the specified id installed on the specified repository. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param uid The installed webhook's id. + @return WebhookSubscription*/ +func (a *WebhooksApiService) RepositoriesUsernameRepoSlugHooksUidGet(ctx context.Context, username string, repoSlug string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param repoSlug + @param uid The installed webhook's id + @return WebhookSubscription*/ +func (a *WebhooksApiService) RepositoriesUsernameRepoSlugHooksUidPut(ctx context.Context, username string, repoSlug string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/repositories/{username}/{repo_slug}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"repo_slug"+"}", fmt.Sprintf("%v", repoSlug), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Returns a paginated list of webhooks installed on this team. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return PaginatedWebhookSubscriptions*/ +func (a *WebhooksApiService) TeamsUsernameHooksGet(ctx context.Context, username string) (PaginatedWebhookSubscriptions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedWebhookSubscriptions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Creates a new webhook on the specified team. Team webhooks are fired for events from all repositories belonging to that team account. Note that only admins can install webhooks on teams. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return WebhookSubscription*/ +func (a *WebhooksApiService) TeamsUsernameHooksPost(ctx context.Context, username string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Deletes the specified webhook subscription from the given team account. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id + @return */ +func (a *WebhooksApiService) TeamsUsernameHooksUidDelete(ctx context.Context, username string, uid 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 + "/teams/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* WebhooksApiService + Returns the webhook with the specified id installed on the given team account. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id. + @return WebhookSubscription*/ +func (a *WebhooksApiService) TeamsUsernameHooksUidGet(ctx context.Context, username string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id + @return WebhookSubscription*/ +func (a *WebhooksApiService) TeamsUsernameHooksUidPut(ctx context.Context, username string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/teams/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Returns a paginated list of webhooks installed on this user account. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return PaginatedWebhookSubscriptions*/ +func (a *WebhooksApiService) UsersUsernameHooksGet(ctx context.Context, username string) (PaginatedWebhookSubscriptions, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload PaginatedWebhookSubscriptions + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Creates a new webhook on the specified user account. Account-level webhooks are fired for events from all repositories belonging to that account. Note that one can only register webhooks on one's own account, not that of others. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @return WebhookSubscription*/ +func (a *WebhooksApiService) UsersUsernameHooksPost(ctx context.Context, username string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/hooks" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Deletes the specified webhook subscription from the given user account. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id + @return */ +func (a *WebhooksApiService) UsersUsernameHooksUidDelete(ctx context.Context, username string, uid 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 + "/users/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + 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 + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + return localVarHttpResponse, err +} + +/* WebhooksApiService + Returns the webhook with the specified id installed on the given user account. + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id. + @return WebhookSubscription*/ +func (a *WebhooksApiService) UsersUsernameHooksUidGet(ctx context.Context, username string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} + +/* WebhooksApiService + Updates the specified webhook subscription. The following properties can be mutated: * `description` * `url` * `active` * `events` + * @param ctx context.Context for authentication, logging, tracing, etc. + @param username + @param uid The installed webhook's id + @return WebhookSubscription*/ +func (a *WebhooksApiService) UsersUsernameHooksUidPut(ctx context.Context, username string, uid string) (WebhookSubscription, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + successPayload WebhookSubscription + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/users/{username}/hooks/{uid}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uid"+"}", fmt.Sprintf("%v", uid), -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 + } + if ctx != nil { + // API Key Authentication + if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { + var key string + if auth.Prefix != "" { + key = auth.Prefix + " " + auth.Key + } else { + key = auth.Key + } + localVarHeaderParams["Authorization"] = key + } + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return successPayload, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return successPayload, localVarHttpResponse, err + } + defer localVarHttpResponse.Body.Close() + if localVarHttpResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) + return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) + } + + if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { + return successPayload, localVarHttpResponse, err + } + + + return successPayload, localVarHttpResponse, err +} +