gitlab 4.2.0 → 4.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -2
- data/LICENSE.txt +1 -1
- data/README.md +96 -25
- data/exe/gitlab +5 -1
- data/lib/gitlab/api.rb +8 -3
- data/lib/gitlab/cli.rb +15 -15
- data/lib/gitlab/cli_helpers.rb +63 -61
- data/lib/gitlab/client/access_requests.rb +103 -0
- data/lib/gitlab/client/application_settings.rb +172 -0
- data/lib/gitlab/client/avatar.rb +21 -0
- data/lib/gitlab/client/award_emojis.rb +5 -3
- data/lib/gitlab/client/boards.rb +62 -4
- data/lib/gitlab/client/branches.rb +53 -14
- data/lib/gitlab/client/broadcast_messages.rb +75 -0
- data/lib/gitlab/client/build_variables.rb +78 -9
- data/lib/gitlab/client/builds.rb +13 -11
- data/lib/gitlab/client/commits.rb +89 -19
- data/lib/gitlab/client/container_registry.rb +85 -0
- data/lib/gitlab/client/deployments.rb +34 -0
- data/lib/gitlab/client/environments.rb +5 -3
- data/lib/gitlab/client/epic_issues.rb +23 -0
- data/lib/gitlab/client/epics.rb +73 -0
- data/lib/gitlab/client/events.rb +60 -0
- data/lib/gitlab/client/features.rb +48 -0
- data/lib/gitlab/client/group_badges.rb +88 -0
- data/lib/gitlab/client/group_boards.rb +141 -0
- data/lib/gitlab/client/group_labels.rb +88 -0
- data/lib/gitlab/client/group_milestones.rb +94 -0
- data/lib/gitlab/client/groups.rb +197 -17
- data/lib/gitlab/client/issue_links.rb +48 -0
- data/lib/gitlab/client/issues.rb +98 -4
- data/lib/gitlab/client/jobs.rb +96 -8
- data/lib/gitlab/client/keys.rb +13 -0
- data/lib/gitlab/client/labels.rb +7 -5
- data/lib/gitlab/client/lint.rb +19 -0
- data/lib/gitlab/client/markdown.rb +23 -0
- data/lib/gitlab/client/merge_request_approvals.rb +265 -0
- data/lib/gitlab/client/merge_requests.rb +237 -9
- data/lib/gitlab/client/milestones.rb +19 -5
- data/lib/gitlab/client/namespaces.rb +4 -2
- data/lib/gitlab/client/notes.rb +58 -12
- data/lib/gitlab/client/pipeline_schedules.rb +147 -0
- data/lib/gitlab/client/pipeline_triggers.rb +12 -10
- data/lib/gitlab/client/pipelines.rb +40 -3
- data/lib/gitlab/client/project_badges.rb +85 -0
- data/lib/gitlab/client/project_clusters.rb +83 -0
- data/lib/gitlab/client/project_release_links.rb +76 -0
- data/lib/gitlab/client/project_releases.rb +79 -0
- data/lib/gitlab/client/projects.rb +280 -47
- data/lib/gitlab/client/protected_tags.rb +59 -0
- data/lib/gitlab/client/remote_mirrors.rb +51 -0
- data/lib/gitlab/client/repositories.rb +60 -6
- data/lib/gitlab/client/repository_files.rb +23 -5
- data/lib/gitlab/client/repository_submodules.rb +27 -0
- data/lib/gitlab/client/resource_label_events.rb +82 -0
- data/lib/gitlab/client/resource_state_events.rb +57 -0
- data/lib/gitlab/client/runners.rb +111 -15
- data/lib/gitlab/client/search.rb +66 -0
- data/lib/gitlab/client/services.rb +4 -1
- data/lib/gitlab/client/sidekiq.rb +39 -0
- data/lib/gitlab/client/snippets.rb +8 -4
- data/lib/gitlab/client/system_hooks.rb +9 -7
- data/lib/gitlab/client/tags.rb +15 -14
- data/lib/gitlab/client/templates.rb +100 -0
- data/lib/gitlab/client/todos.rb +7 -5
- data/lib/gitlab/client/user_snippets.rb +114 -0
- data/lib/gitlab/client/users.rb +166 -30
- data/lib/gitlab/client/versions.rb +18 -0
- data/lib/gitlab/client/wikis.rb +79 -0
- data/lib/gitlab/client.rb +49 -12
- data/lib/gitlab/configuration.rb +8 -6
- data/lib/gitlab/error.rb +74 -5
- data/lib/gitlab/file_response.rb +5 -3
- data/lib/gitlab/help.rb +19 -20
- data/lib/gitlab/objectified_hash.rb +27 -10
- data/lib/gitlab/page_links.rb +11 -9
- data/lib/gitlab/paginated_response.rb +37 -24
- data/lib/gitlab/request.rb +42 -53
- data/lib/gitlab/shell.rb +11 -12
- data/lib/gitlab/shell_history.rb +11 -13
- data/lib/gitlab/version.rb +3 -1
- data/lib/gitlab.rb +19 -8
- metadata +50 -395
- data/.gitignore +0 -22
- data/.travis.yml +0 -8
- data/CONTRIBUTING.md +0 -195
- data/Gemfile +0 -4
- data/Rakefile +0 -9
- data/bin/console +0 -10
- data/bin/setup +0 -6
- data/gitlab.gemspec +0 -31
- data/spec/fixtures/board_list.json +0 -1
- data/spec/fixtures/board_lists.json +0 -1
- data/spec/fixtures/boards.json +0 -1
- data/spec/fixtures/branch.json +0 -1
- data/spec/fixtures/branch_delete.json +0 -3
- data/spec/fixtures/branches.json +0 -1
- data/spec/fixtures/build.json +0 -38
- data/spec/fixtures/build_artifacts.json +0 -0
- data/spec/fixtures/build_cancel.json +0 -24
- data/spec/fixtures/build_erase.json +0 -24
- data/spec/fixtures/build_retry.json +0 -24
- data/spec/fixtures/builds.json +0 -78
- data/spec/fixtures/builds_commits.json +0 -64
- data/spec/fixtures/compare_merge_request_diff.json +0 -31
- data/spec/fixtures/empty.json +0 -0
- data/spec/fixtures/environment.json +0 -6
- data/spec/fixtures/environments.json +0 -14
- data/spec/fixtures/error_already_exists.json +0 -1
- data/spec/fixtures/error_project_not_found.json +0 -1
- data/spec/fixtures/get_repository_file.json +0 -1
- data/spec/fixtures/group.json +0 -60
- data/spec/fixtures/group_create.json +0 -1
- data/spec/fixtures/group_create_with_description.json +0 -1
- data/spec/fixtures/group_delete.json +0 -1
- data/spec/fixtures/group_member.json +0 -1
- data/spec/fixtures/group_member_delete.json +0 -1
- data/spec/fixtures/group_member_edit.json +0 -1
- data/spec/fixtures/group_members.json +0 -1
- data/spec/fixtures/group_projects.json +0 -44
- data/spec/fixtures/group_search.json +0 -2
- data/spec/fixtures/groups.json +0 -2
- data/spec/fixtures/issue.json +0 -1
- data/spec/fixtures/issue_award_emoji.json +0 -16
- data/spec/fixtures/issue_award_emojis.json +0 -34
- data/spec/fixtures/issues.json +0 -1
- data/spec/fixtures/job.json +0 -43
- data/spec/fixtures/job_trace.json +0 -1
- data/spec/fixtures/jobs.json +0 -91
- data/spec/fixtures/key.json +0 -1
- data/spec/fixtures/keys.json +0 -1
- data/spec/fixtures/label.json +0 -1
- data/spec/fixtures/label_unsubscribe.json +0 -1
- data/spec/fixtures/labels.json +0 -1
- data/spec/fixtures/merge_request.json +0 -1
- data/spec/fixtures/merge_request_award_emoji.json +0 -16
- data/spec/fixtures/merge_request_award_emojis.json +0 -34
- data/spec/fixtures/merge_request_changes.json +0 -1
- data/spec/fixtures/merge_request_closes_issues.json +0 -1
- data/spec/fixtures/merge_request_comment.json +0 -1
- data/spec/fixtures/merge_request_comments.json +0 -1
- data/spec/fixtures/merge_request_commits.json +0 -1
- data/spec/fixtures/merge_requests.json +0 -1
- data/spec/fixtures/milestone.json +0 -1
- data/spec/fixtures/milestone_issues.json +0 -1
- data/spec/fixtures/milestone_merge_requests.json +0 -1
- data/spec/fixtures/milestones.json +0 -1
- data/spec/fixtures/namespaces.json +0 -1
- data/spec/fixtures/note.json +0 -1
- data/spec/fixtures/note_award_emoji.json +0 -16
- data/spec/fixtures/note_award_emojis.json +0 -18
- data/spec/fixtures/notes.json +0 -1
- data/spec/fixtures/pipeline.json +0 -23
- data/spec/fixtures/pipeline_cancel.json +0 -23
- data/spec/fixtures/pipeline_create.json +0 -23
- data/spec/fixtures/pipeline_jobs.json +0 -91
- data/spec/fixtures/pipeline_retry.json +0 -23
- data/spec/fixtures/pipelines.json +0 -48
- data/spec/fixtures/project.json +0 -1
- data/spec/fixtures/project_commit.json +0 -13
- data/spec/fixtures/project_commit_comment.json +0 -1
- data/spec/fixtures/project_commit_comments.json +0 -1
- data/spec/fixtures/project_commit_create.json +0 -22
- data/spec/fixtures/project_commit_diff.json +0 -10
- data/spec/fixtures/project_commit_status.json +0 -42
- data/spec/fixtures/project_commits.json +0 -1
- data/spec/fixtures/project_edit.json +0 -21
- data/spec/fixtures/project_events.json +0 -1
- data/spec/fixtures/project_for_user.json +0 -1
- data/spec/fixtures/project_fork.json +0 -50
- data/spec/fixtures/project_fork_link.json +0 -1
- data/spec/fixtures/project_forked_for_user.json +0 -50
- data/spec/fixtures/project_hook.json +0 -1
- data/spec/fixtures/project_hooks.json +0 -1
- data/spec/fixtures/project_issues.json +0 -1
- data/spec/fixtures/project_key.json +0 -6
- data/spec/fixtures/project_keys.json +0 -6
- data/spec/fixtures/project_runner_enable.json +0 -7
- data/spec/fixtures/project_runners.json +0 -16
- data/spec/fixtures/project_search.json +0 -1
- data/spec/fixtures/project_star.json +0 -44
- data/spec/fixtures/project_tag_annotated.json +0 -1
- data/spec/fixtures/project_tag_lightweight.json +0 -1
- data/spec/fixtures/project_tags.json +0 -1
- data/spec/fixtures/project_unstar.json +0 -44
- data/spec/fixtures/project_update_commit_status.json +0 -20
- data/spec/fixtures/projects.json +0 -1
- data/spec/fixtures/push_rule.json +0 -1
- data/spec/fixtures/raw_file.json +0 -2
- data/spec/fixtures/release_create.json +0 -1
- data/spec/fixtures/release_update.json +0 -1
- data/spec/fixtures/repository_file.json +0 -1
- data/spec/fixtures/run_trigger.json +0 -1
- data/spec/fixtures/runner.json +0 -26
- data/spec/fixtures/runner_delete.json +0 -7
- data/spec/fixtures/runner_edit.json +0 -26
- data/spec/fixtures/runners.json +0 -16
- data/spec/fixtures/runners_all.json +0 -30
- data/spec/fixtures/service.json +0 -1
- data/spec/fixtures/session.json +0 -1
- data/spec/fixtures/shell_history.json +0 -2
- data/spec/fixtures/snippet.json +0 -1
- data/spec/fixtures/snippet_award_emoji.json +0 -16
- data/spec/fixtures/snippet_award_emojis.json +0 -34
- data/spec/fixtures/snippet_content.json +0 -3
- data/spec/fixtures/snippets.json +0 -1
- data/spec/fixtures/system_hook.json +0 -1
- data/spec/fixtures/system_hooks.json +0 -1
- data/spec/fixtures/tag.json +0 -1
- data/spec/fixtures/tag_create.json +0 -1
- data/spec/fixtures/tag_create_with_description.json +0 -1
- data/spec/fixtures/tag_delete.json +0 -1
- data/spec/fixtures/tags.json +0 -1
- data/spec/fixtures/team_member.json +0 -1
- data/spec/fixtures/team_members.json +0 -1
- data/spec/fixtures/todo.json +0 -73
- data/spec/fixtures/todos.json +0 -148
- data/spec/fixtures/tree.json +0 -1
- data/spec/fixtures/trigger.json +0 -10
- data/spec/fixtures/triggers.json +0 -12
- data/spec/fixtures/user.json +0 -1
- data/spec/fixtures/user_block_unblock.json +0 -1
- data/spec/fixtures/user_email.json +0 -1
- data/spec/fixtures/user_emails.json +0 -1
- data/spec/fixtures/user_search.json +0 -1
- data/spec/fixtures/users.json +0 -1
- data/spec/fixtures/variable.json +0 -4
- data/spec/fixtures/variables.json +0 -10
- data/spec/gitlab/cli_helpers_spec.rb +0 -57
- data/spec/gitlab/cli_spec.rb +0 -119
- data/spec/gitlab/client/award_emojis_spec.rb +0 -391
- data/spec/gitlab/client/boards_spec.rb +0 -94
- data/spec/gitlab/client/branches_spec.rb +0 -116
- data/spec/gitlab/client/build_variables_spec.rb +0 -86
- data/spec/gitlab/client/builds_spec.rb +0 -148
- data/spec/gitlab/client/client_spec.rb +0 -11
- data/spec/gitlab/client/commits_spec.rb +0 -168
- data/spec/gitlab/client/environments_spec.rb +0 -132
- data/spec/gitlab/client/groups_spec.rb +0 -195
- data/spec/gitlab/client/issues_spec.rb +0 -186
- data/spec/gitlab/client/jobs_spec.rb +0 -135
- data/spec/gitlab/client/keys_spec.rb +0 -19
- data/spec/gitlab/client/labels_spec.rb +0 -100
- data/spec/gitlab/client/merge_requests_spec.rb +0 -224
- data/spec/gitlab/client/milestones_spec.rb +0 -98
- data/spec/gitlab/client/namespaces_spec.rb +0 -22
- data/spec/gitlab/client/notes_spec.rb +0 -333
- data/spec/gitlab/client/pipeline_triggers_spec.rb +0 -157
- data/spec/gitlab/client/pipelines_spec.rb +0 -95
- data/spec/gitlab/client/projects_spec.rb +0 -613
- data/spec/gitlab/client/repositories_spec.rb +0 -94
- data/spec/gitlab/client/repository_files_spec.rb +0 -95
- data/spec/gitlab/client/runners_spec.rb +0 -185
- data/spec/gitlab/client/services_spec.rb +0 -55
- data/spec/gitlab/client/snippets_spec.rb +0 -100
- data/spec/gitlab/client/system_hooks_spec.rb +0 -69
- data/spec/gitlab/client/tags_spec.rb +0 -109
- data/spec/gitlab/client/todos_spec.rb +0 -45
- data/spec/gitlab/client/users_spec.rb +0 -418
- data/spec/gitlab/error_spec.rb +0 -45
- data/spec/gitlab/file_response_spec.rb +0 -33
- data/spec/gitlab/help_spec.rb +0 -46
- data/spec/gitlab/objectified_hash_spec.rb +0 -48
- data/spec/gitlab/page_links_spec.rb +0 -16
- data/spec/gitlab/paginated_response_spec.rb +0 -60
- data/spec/gitlab/request_spec.rb +0 -73
- data/spec/gitlab/shell_history_spec.rb +0 -53
- data/spec/gitlab/shell_spec.rb +0 -80
- data/spec/gitlab_spec.rb +0 -97
- data/spec/spec_helper.rb +0 -74
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Gitlab::Client
|
|
4
|
+
# Defines methods related to lint/validations.
|
|
5
|
+
# @see https://docs.gitlab.com/ce/api/lint.html
|
|
6
|
+
module Lint
|
|
7
|
+
# Checks if your .gitlab-ci.yml file is valid.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# Gitlab.validate_gitlab_ci_yml("{ \"image\": \"ruby:2.6\", \"services\": [\"postgres\"], \"before_script\": [\"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}")
|
|
11
|
+
#
|
|
12
|
+
# @param [String] content the .gitlab-ci.yaml content.
|
|
13
|
+
# @return <Gitlab::ObjectifiedHash> Returns information about validity of the yml.
|
|
14
|
+
def validate_gitlab_ci_yml(content)
|
|
15
|
+
body = { content: content }
|
|
16
|
+
post('/lint', body: body)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Gitlab::Client
|
|
4
|
+
# Defines methods related to markdown.
|
|
5
|
+
# @see https://docs.gitlab.com/ce/api/markdown.html
|
|
6
|
+
module Markdown
|
|
7
|
+
# Render an arbitrary Markdown document
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# Gitlab.markdown('Hello world! :tada:')
|
|
11
|
+
# Gitlab.markdown('Hello world! :tada:', gfm: true, project: 'group_example/project_example')
|
|
12
|
+
#
|
|
13
|
+
# @param [String] text The markdown text to render.
|
|
14
|
+
# @param [Hash] options A customizable set of options.
|
|
15
|
+
# @option options [Boolean] :gfm(optional) Render text using GitLab Flavored Markdown. Default is false.
|
|
16
|
+
# @option options [String] :project(optional) Use project as a context when creating references using GitLab Flavored Markdown. Authentication is required if a project is not public.
|
|
17
|
+
# @return <Gitlab::ObjectifiedHash> Returns the rendered markdown as response
|
|
18
|
+
def markdown(text, options = {})
|
|
19
|
+
body = { text: text }.merge(options)
|
|
20
|
+
post('/markdown', body: body)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Gitlab::Client
|
|
4
|
+
# Defines methods related to MR Approvals.
|
|
5
|
+
# @see https://docs.gitlab.com/ee/api/merge_request_approvals.html
|
|
6
|
+
module MergeRequestApprovals
|
|
7
|
+
# Gets MR Approval Configuration for a project
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# Gitlab.project_merge_request_approvals(1)
|
|
11
|
+
#
|
|
12
|
+
# @param [Integer] project The ID of a project.
|
|
13
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
|
14
|
+
def project_merge_request_approvals(project)
|
|
15
|
+
get("/projects/#{url_encode project}/approvals")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Change MR Approval Configuration for a project
|
|
19
|
+
#
|
|
20
|
+
# @example
|
|
21
|
+
# Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3})
|
|
22
|
+
# Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, reset_approvals_on_push: true})
|
|
23
|
+
# Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, disable_overriding_approvers_per_merge_request: false})
|
|
24
|
+
#
|
|
25
|
+
# @param [Integer] project(required) The ID of a project.
|
|
26
|
+
# @option options [Integer] :approvals_before_merge(optional) How many approvals are required before an MR can be merged
|
|
27
|
+
# @option options [Boolean] :reset_approvals_on_push(optional) Reset approvals on a new push
|
|
28
|
+
# @option options [Boolean] :disable_overriding_approvers_per_merge_request(optional) Allow/Disallow overriding approvers per MR
|
|
29
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
|
30
|
+
def edit_project_merge_request_approvals(project, options = {})
|
|
31
|
+
post("/projects/#{url_encode project}/approvals", body: options)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Gets MR Approval Rules for a project
|
|
35
|
+
#
|
|
36
|
+
# @example
|
|
37
|
+
# Gitlab.project_merge_request_approval_rules(1)
|
|
38
|
+
#
|
|
39
|
+
# @param [Integer] project The ID of a project.
|
|
40
|
+
# @return [Gitlab::ObjectifiedHash] MR approval rules for the project
|
|
41
|
+
def project_merge_request_approval_rules(project)
|
|
42
|
+
get("/projects/#{url_encode project}/approval_rules")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Create MR Approval Rule for a project
|
|
46
|
+
#
|
|
47
|
+
# @example
|
|
48
|
+
# Gitlab.create_project_merge_request_approval_rule(1, {name: "security", approvals_required: 1})
|
|
49
|
+
#
|
|
50
|
+
# @param [Integer] project(required) The ID of a project.
|
|
51
|
+
# @option options [String] :name(required) The name of the approval rule
|
|
52
|
+
# @option options [Integer] :approvals_required(required) The number of required approvals for this rule
|
|
53
|
+
# @option options [Array] :user_ids(optional) The ids of users as approvers
|
|
54
|
+
# @option options [Array] :group_ids(optional) The ids of groups as approvers
|
|
55
|
+
# @option options [Array] :protected_branch_ids(optional) The ids of protected branches to scope the rule by
|
|
56
|
+
# @return [Gitlab::ObjectifiedHash] New MR approval rule
|
|
57
|
+
def create_project_merge_request_approval_rule(project, options = {})
|
|
58
|
+
post("/projects/#{url_encode project}/approval_rules", body: options)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Update MR Approval Rule for a project
|
|
62
|
+
#
|
|
63
|
+
# @example
|
|
64
|
+
# Gitlab.update_project_merge_request_approval_rule(1, {name: "security", approvals_required: 2})
|
|
65
|
+
#
|
|
66
|
+
# @param [Integer] project(required) The ID of a project.
|
|
67
|
+
# @param [Integer] approval_rule_id(required) The ID of a project Approval Rule
|
|
68
|
+
# @option options [String] :name(required) The name of the approval rule
|
|
69
|
+
# @option options [Integer] :approvals_required(required) The number of required approvals for this rule
|
|
70
|
+
# @option options [Array] :user_ids(optional) The ids of users as approvers
|
|
71
|
+
# @option options [Array] :group_ids(optional) The ids of groups as approvers
|
|
72
|
+
# @option options [Array] :protected_branch_ids(optional) The ids of protected branches to scope the rule by
|
|
73
|
+
# @return [Gitlab::ObjectifiedHash] Updated MR approval rule
|
|
74
|
+
def update_project_merge_request_approval_rule(project, approval_rule_id, options = {})
|
|
75
|
+
put("/projects/#{url_encode project}/approval_rules/#{approval_rule_id}", body: options)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Delete MR Approval Rule for a project
|
|
79
|
+
#
|
|
80
|
+
# @example
|
|
81
|
+
# Gitlab.delete_project_merge_request_approval_rule(1, 1)
|
|
82
|
+
#
|
|
83
|
+
# @param [Integer] project(required) The ID of a project.
|
|
84
|
+
# @param [Integer] approval_rule_id(required) The ID of a approval rule
|
|
85
|
+
# @return [void] This API call returns an empty response body
|
|
86
|
+
def delete_project_merge_request_approval_rule(project, approval_rule_id)
|
|
87
|
+
delete("/projects/#{url_encode project}/approval_rules/#{approval_rule_id}")
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Change allowed approvers and approver groups for a project
|
|
91
|
+
# @deprecated Since Gitlab 13.12 /approvers endpoints are removed!!!
|
|
92
|
+
# See Gitlab.create_project_merge_request_approval_rule
|
|
93
|
+
#
|
|
94
|
+
# @example
|
|
95
|
+
# Gitlab.edit_project_approvers(1, {approver_ids: [5], approver_groups: [1]})
|
|
96
|
+
#
|
|
97
|
+
# @param [Integer] project(required) The ID of a project.
|
|
98
|
+
# @option options [Array] :approver_ids(required, nil if none) An array of User IDs that can approve MRs
|
|
99
|
+
# @option options [Array] :approver_group_ids(required, nil if none) An array of Group IDs whose members can approve MRs
|
|
100
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
|
101
|
+
def edit_project_approvers(project, options = {})
|
|
102
|
+
put("/projects/#{url_encode project}/approvers", body: options)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Get Configuration for approvals on a specific Merge Request.
|
|
106
|
+
#
|
|
107
|
+
# @example
|
|
108
|
+
# Gitlab.merge_request_approvals(1, 5)
|
|
109
|
+
#
|
|
110
|
+
# @param [Integer] project(required) The ID of a project.
|
|
111
|
+
# @param [Integer] merge_request(required) The IID of a merge_request.
|
|
112
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the merge request
|
|
113
|
+
def merge_request_approvals(project, merge_request)
|
|
114
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals")
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Change configuration for approvals on a specific merge request.
|
|
118
|
+
#
|
|
119
|
+
# @example
|
|
120
|
+
# Gitlab.edit_merge_request_approvals(1, 5, approvals_required: 2)
|
|
121
|
+
#
|
|
122
|
+
# @param [Integer] project(required) The ID of a project.
|
|
123
|
+
# @param [Integer] merge_request(required) The IID of a merge_request.
|
|
124
|
+
# @option options [Integer] :approvals_required(required) Approvals required before MR can be merged
|
|
125
|
+
# @return [Gitlab::ObjectifiedHash] Updated MR approval configuration information about the merge request
|
|
126
|
+
def edit_merge_request_approvals(project, merge_request, options = {})
|
|
127
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Change allowed approvers and approver groups for a merge request
|
|
131
|
+
# @deprecated Since Gitlab 13.12 /approvers endpoints are removed!!!
|
|
132
|
+
# See Gitlab.create_merge_request_level_rule
|
|
133
|
+
#
|
|
134
|
+
# @example
|
|
135
|
+
# Gitlab.edit_merge_request_approvers(1, 5, {approver_ids: [5], approver_groups: [1]})
|
|
136
|
+
#
|
|
137
|
+
# @param [Integer] project(required) The ID of a project.
|
|
138
|
+
# @param [Integer] merge_request(required) The IID of a merge_request.
|
|
139
|
+
# @option options [Array] :approver_ids(required, nil if none) An array of User IDs that can approve MRs
|
|
140
|
+
# @option options [Array] :approver_group_ids(required, nil if none) An array of Group IDs whose members can approve MRs
|
|
141
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
|
142
|
+
def edit_merge_request_approvers(project, merge_request, options = {})
|
|
143
|
+
put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvers", body: options)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Create merge request level rule
|
|
147
|
+
#
|
|
148
|
+
# @example
|
|
149
|
+
# Gitlab.create_merge_request_level_rule(1, 2, {
|
|
150
|
+
# name: "devs",
|
|
151
|
+
# approvals_required: 2,
|
|
152
|
+
# approval_project_rule_id: 99,
|
|
153
|
+
# user_ids: [3, 4],
|
|
154
|
+
# group_ids: [5, 6],
|
|
155
|
+
# })
|
|
156
|
+
#
|
|
157
|
+
# Important: When approval_project_rule_id is set, the name, users and groups of project-level rule are copied.
|
|
158
|
+
# The approvals_required specified is used.
|
|
159
|
+
#
|
|
160
|
+
# @param [Integer] project(required) The ID of a project.
|
|
161
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
|
162
|
+
# @option options [String] :name(required) The name of the approval rule
|
|
163
|
+
# @option options [Integer] :approvals_required(required) The number of required approvals for this rule
|
|
164
|
+
# @option options [Integer] :approval_project_rule_id(optional) The ID of a project-level approval rule
|
|
165
|
+
# @option options [Array] :user_ids(optional) The ids of users as approvers
|
|
166
|
+
# @option options [Array] :group_ids(optional) The ids of groups as approvers
|
|
167
|
+
# @return [Gitlab::ObjectifiedHash] New MR level approval rule
|
|
168
|
+
def create_merge_request_level_rule(project, merge_request, options = {})
|
|
169
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules", body: options)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Get merge request level rule
|
|
173
|
+
#
|
|
174
|
+
# @example
|
|
175
|
+
# Gitlab.merge_request_level_rule(1, 2)
|
|
176
|
+
#
|
|
177
|
+
# @param [Integer] project(required) The ID of a project.
|
|
178
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
|
179
|
+
# @return [Gitlab::ObjectifiedHash] New MR level approval rule
|
|
180
|
+
def merge_request_level_rule(project, merge_request)
|
|
181
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules")
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Update merge request level rule
|
|
185
|
+
#
|
|
186
|
+
# @example
|
|
187
|
+
# Gitlab.update_merge_request_level_rule(1, 2, 69, {
|
|
188
|
+
# name: "devs",
|
|
189
|
+
# approvals_required: 2,
|
|
190
|
+
# user_ids: [3, 4],
|
|
191
|
+
# group_ids: [5, 6],
|
|
192
|
+
# })
|
|
193
|
+
#
|
|
194
|
+
# Important: Approvers and groups not in the users/groups parameters are removed
|
|
195
|
+
# Important: Updating a report_approver or code_owner rule is not allowed.
|
|
196
|
+
# These are system generated rules.
|
|
197
|
+
#
|
|
198
|
+
# @param [Integer] project(required) The ID of a project.
|
|
199
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
|
200
|
+
# @param [Integer] appr_rule_id(required) The ID of a approval rule
|
|
201
|
+
# @option options [String] :name(required) The name of the approval rule
|
|
202
|
+
# @option options [Integer] :approvals_required(required) The number of required approvals for this rule
|
|
203
|
+
# @option options [Array] :user_ids(optional) The ids of users as approvers
|
|
204
|
+
# @option options [Array] :group_ids(optional) The ids of groups as approvers
|
|
205
|
+
# @return [Gitlab::ObjectifiedHash] Updated MR level approval rule
|
|
206
|
+
def update_merge_request_level_rule(project, merge_request, appr_rule_id, options = {})
|
|
207
|
+
put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}", body: options)
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Delete merge request level rule
|
|
211
|
+
#
|
|
212
|
+
# @example
|
|
213
|
+
# Gitlab.delete_merge_request_level_rule(1, 2, 69)
|
|
214
|
+
#
|
|
215
|
+
# Important: Deleting a report_approver or code_owner rule is not allowed.
|
|
216
|
+
# These are system generated rules.
|
|
217
|
+
#
|
|
218
|
+
# @param [Integer] project(required) The ID of a project.
|
|
219
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
|
220
|
+
# @param [Integer] appr_rule_id(required) The ID of a approval rule
|
|
221
|
+
# @return [void] This API call returns an empty response body
|
|
222
|
+
def delete_merge_request_level_rule(project, merge_request, appr_rule_id)
|
|
223
|
+
delete("/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}")
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Approve a merge request
|
|
227
|
+
#
|
|
228
|
+
# @example
|
|
229
|
+
# Gitlab.approve_merge_request(1, 5)
|
|
230
|
+
# Gitlab.approve_merge_request(1, 5, sha: 'fe678da')
|
|
231
|
+
#
|
|
232
|
+
# @param [Integer] project(required) The ID of a project.
|
|
233
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
|
234
|
+
# @option options [String] :sha(optional) The HEAD of the MR
|
|
235
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
|
236
|
+
def approve_merge_request(project, merge_request, options = {})
|
|
237
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approve", body: options)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Unapprove a merge request
|
|
241
|
+
#
|
|
242
|
+
# @example
|
|
243
|
+
# Gitlab.unapprove_merge_request(1, 5)
|
|
244
|
+
#
|
|
245
|
+
# @param [Integer] project(required) The ID of a project.
|
|
246
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
|
247
|
+
# @option options [String] :sudo(optional) The username of the user you want to remove the approval for
|
|
248
|
+
# @return [void] This API call returns an empty response body.
|
|
249
|
+
def unapprove_merge_request(project, merge_request, options = {})
|
|
250
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove", body: options)
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# Get the approval state of merge requests
|
|
254
|
+
#
|
|
255
|
+
# @example
|
|
256
|
+
# Gitlab.merge_request_approval_state(5, 36)
|
|
257
|
+
#
|
|
258
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
259
|
+
# @param [Integer] id The ID of a merge request.
|
|
260
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
261
|
+
def merge_request_approval_state(project, id)
|
|
262
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}/approval_state")
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
end
|
|
@@ -1,19 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class Gitlab::Client
|
|
2
4
|
# Defines methods related to merge requests.
|
|
3
5
|
# @see https://docs.gitlab.com/ce/api/merge_requests.html
|
|
4
6
|
module MergeRequests
|
|
7
|
+
# Gets a list of all of the merge requests the authenticated user has access to.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# Gitlab.user_merge_requests
|
|
11
|
+
# Gitlab.user_merge_requests(state: :opened, scope: :all)
|
|
12
|
+
#
|
|
13
|
+
# @param [Hash] options A customizable set of options.
|
|
14
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
15
|
+
def user_merge_requests(options = {})
|
|
16
|
+
get('/merge_requests', query: options)
|
|
17
|
+
end
|
|
18
|
+
|
|
5
19
|
# Gets a list of project merge requests.
|
|
6
20
|
#
|
|
7
21
|
# @example
|
|
8
22
|
# Gitlab.merge_requests(5)
|
|
9
|
-
# Gitlab.merge_requests({ per_page: 40 })
|
|
23
|
+
# Gitlab.merge_requests(5, { per_page: 40 })
|
|
10
24
|
#
|
|
11
25
|
# @param [Integer, String] project The ID or name of a project.
|
|
12
26
|
# @param [Hash] options A customizable set of options.
|
|
13
27
|
# @option options [Integer] :page The page number.
|
|
14
28
|
# @option options [Integer] :per_page The number of results per page.
|
|
15
29
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
16
|
-
def merge_requests(project, options={})
|
|
30
|
+
def merge_requests(project, options = {})
|
|
17
31
|
get("/projects/#{url_encode project}/merge_requests", query: options)
|
|
18
32
|
end
|
|
19
33
|
|
|
@@ -21,12 +35,59 @@ class Gitlab::Client
|
|
|
21
35
|
#
|
|
22
36
|
# @example
|
|
23
37
|
# Gitlab.merge_request(5, 36)
|
|
38
|
+
# Gitlab.merge_request(5, 36, { include_diverged_commits_count: true })
|
|
24
39
|
#
|
|
25
40
|
# @param [Integer, String] project The ID or name of a project.
|
|
26
41
|
# @param [Integer] id The ID of a merge request.
|
|
42
|
+
# @option options [Boolean] :render_html If true response includes rendered HTML for title and description.
|
|
43
|
+
# @option options [Boolean] :include_diverged_commits_count If true response includes the commits behind the target branch.
|
|
44
|
+
# @option options [Boolean] :include_rebase_in_progress If true response includes whether a rebase operation is in progress.
|
|
27
45
|
# @return <Gitlab::ObjectifiedHash]
|
|
28
|
-
def merge_request(project, id)
|
|
29
|
-
get("/projects/#{url_encode project}/merge_requests/#{id}")
|
|
46
|
+
def merge_request(project, id, options = {})
|
|
47
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}", query: options)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Gets a list of merge request pipelines.
|
|
51
|
+
#
|
|
52
|
+
# @example
|
|
53
|
+
# Gitlab.merge_request_pipelines(5, 36)
|
|
54
|
+
#
|
|
55
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
56
|
+
# @param [Integer] id The ID of a merge request.
|
|
57
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
58
|
+
def merge_request_pipelines(project, id)
|
|
59
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}/pipelines")
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Create a new pipeline for a merge request.
|
|
63
|
+
# A pipeline created via this endpoint doesnt run a regular branch/tag pipeline.
|
|
64
|
+
# It requires .gitlab-ci.yml to be configured with only: [merge_requests] to create jobs.
|
|
65
|
+
#
|
|
66
|
+
# The new pipeline can be:
|
|
67
|
+
#
|
|
68
|
+
# A detached merge request pipeline.
|
|
69
|
+
# A pipeline for merged results if the project setting is enabled.
|
|
70
|
+
#
|
|
71
|
+
# @example
|
|
72
|
+
# Gitlab.create_merge_request_pipeline(5, 36)
|
|
73
|
+
#
|
|
74
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
75
|
+
# @param [Integer] iid The internal ID of a merge request.
|
|
76
|
+
# @return [Gitlab::ObjectifiedHash]
|
|
77
|
+
def create_merge_request_pipeline(project, iid)
|
|
78
|
+
post("/projects/#{url_encode project}/merge_requests/#{iid}/pipelines")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Get a list of merge request participants.
|
|
82
|
+
#
|
|
83
|
+
# @example
|
|
84
|
+
# Gitlab.merge_request_participants(5, 36)
|
|
85
|
+
#
|
|
86
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
87
|
+
# @param [Integer] id The ID of a merge request.
|
|
88
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
|
89
|
+
def merge_request_participants(project, id)
|
|
90
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}/participants")
|
|
30
91
|
end
|
|
31
92
|
|
|
32
93
|
# Creates a merge request.
|
|
@@ -43,9 +104,16 @@ class Gitlab::Client
|
|
|
43
104
|
# @option options [String] :source_branch (required) The source branch name.
|
|
44
105
|
# @option options [String] :target_branch (required) The target branch name.
|
|
45
106
|
# @option options [Integer] :assignee_id (optional) The ID of a user to assign merge request.
|
|
107
|
+
# @option options [Array<Integer>] :assignee_ids (optional) The ID of the user(s) to assign the MR to. Set to 0 or provide an empty value to unassign all assignees.
|
|
108
|
+
# @option options [String] :description (optional) Description of MR. Limited to 1,048,576 characters.
|
|
46
109
|
# @option options [Integer] :target_project_id (optional) The target project ID.
|
|
110
|
+
# @option options [String] :labels (optional) Labels as a comma-separated list.
|
|
111
|
+
# @option options [Integer] :milestone_id (optional) The global ID of a milestone
|
|
112
|
+
# @option options [Boolean] :remove_source_branch (optional) Flag indicating if a merge request should remove the source branch when merging
|
|
113
|
+
# @option options [Boolean] :allow_collaboration (optional) Allow commits from members who can merge to the target branch
|
|
114
|
+
# @option options [Boolean] :squash (optional) Squash commits into a single commit when merging
|
|
47
115
|
# @return [Gitlab::ObjectifiedHash] Information about created merge request.
|
|
48
|
-
def create_merge_request(project, title, options={})
|
|
116
|
+
def create_merge_request(project, title, options = {})
|
|
49
117
|
body = { title: title }.merge(options)
|
|
50
118
|
post("/projects/#{url_encode project}/merge_requests", body: body)
|
|
51
119
|
end
|
|
@@ -64,7 +132,7 @@ class Gitlab::Client
|
|
|
64
132
|
# @option options [Integer] :assignee_id The ID of a user to assign merge request.
|
|
65
133
|
# @option options [String] :state_event New state (close|reopen|merge).
|
|
66
134
|
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
|
67
|
-
def update_merge_request(project, id, options={})
|
|
135
|
+
def update_merge_request(project, id, options = {})
|
|
68
136
|
put("/projects/#{url_encode project}/merge_requests/#{id}", body: options)
|
|
69
137
|
end
|
|
70
138
|
|
|
@@ -76,9 +144,14 @@ class Gitlab::Client
|
|
|
76
144
|
# @param [Integer, String] project The ID or name of a project.
|
|
77
145
|
# @param [Integer] id The ID of a merge request.
|
|
78
146
|
# @param [Hash] options A customizable set of options.
|
|
79
|
-
# @option options [String] :merge_commit_message Custom merge commit message
|
|
147
|
+
# @option options [String] :merge_commit_message(optional) Custom merge commit message
|
|
148
|
+
# @option options [String] :squash_commit_message(optional) Custom squash commit message
|
|
149
|
+
# @option options [Boolean] :squash(optional) if true the commits will be squashed into a single commit on merge
|
|
150
|
+
# @option options [Boolean] :should_remove_source_branch(optional) if true removes the source branch
|
|
151
|
+
# @option options [Boolean] :merge_when_pipeline_succeeds(optional) if true the MR is merged when the pipeline succeeds
|
|
152
|
+
# @option options [String] :sha(optional) if present, then this SHA must match the HEAD of the source branch, otherwise the merge will fail
|
|
80
153
|
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
|
81
|
-
def accept_merge_request(project, id, options={})
|
|
154
|
+
def accept_merge_request(project, id, options = {})
|
|
82
155
|
put("/projects/#{url_encode project}/merge_requests/#{id}/merge", body: options)
|
|
83
156
|
end
|
|
84
157
|
|
|
@@ -114,7 +187,7 @@ class Gitlab::Client
|
|
|
114
187
|
# @param [Integer] project The ID of a project
|
|
115
188
|
# @param [Integer] iid The internal ID of a merge request
|
|
116
189
|
def merge_request_closes_issues(project_id, merge_request_iid)
|
|
117
|
-
get("/projects/#{project_id}/merge_requests/#{merge_request_iid}/closes_issues")
|
|
190
|
+
get("/projects/#{url_encode project_id}/merge_requests/#{merge_request_iid}/closes_issues")
|
|
118
191
|
end
|
|
119
192
|
|
|
120
193
|
# Subscribes to a merge request.
|
|
@@ -142,5 +215,160 @@ class Gitlab::Client
|
|
|
142
215
|
def unsubscribe_from_merge_request(project, id)
|
|
143
216
|
post("/projects/#{url_encode project}/merge_requests/#{id}/unsubscribe")
|
|
144
217
|
end
|
|
218
|
+
|
|
219
|
+
# List project merge request discussions
|
|
220
|
+
#
|
|
221
|
+
# @example
|
|
222
|
+
# Gitlab.merge_request_discussions(5, 1)
|
|
223
|
+
# Gitlab.merge_request_discussions('gitlab', 1)
|
|
224
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
225
|
+
# @param [Integer] id The ID of a merge request.
|
|
226
|
+
# @return [Gitlab::ObjectifiedHash] List of the merge request discussions.
|
|
227
|
+
def merge_request_discussions(project, merge_request_id)
|
|
228
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions")
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Get single merge request discussion
|
|
232
|
+
#
|
|
233
|
+
# @example
|
|
234
|
+
# Gitlab.merge_request_discussion(5, 1, 1)
|
|
235
|
+
# Gitlab.merge_request_discussion('gitlab', 1, 1)
|
|
236
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
237
|
+
# @param [Integer] id The ID of a merge request.
|
|
238
|
+
# @param [Integer] discussion_id The ID of a discussion.
|
|
239
|
+
# @return [Gitlab::ObjectifiedHash] The merge request discussion.
|
|
240
|
+
def merge_request_discussion(project, merge_request_id, discussion_id)
|
|
241
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}")
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Create new merge request discussion
|
|
245
|
+
#
|
|
246
|
+
# @example
|
|
247
|
+
# Gitlab.create_merge_request_discussion(5, 1, body: 'discuss')
|
|
248
|
+
# Gitlab.create_merge_request_discussion('gitlab', 1, body: 'discuss')
|
|
249
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
250
|
+
# @param [Integer] id The ID of a merge request.
|
|
251
|
+
# @param [Hash] options A customizable set of options.
|
|
252
|
+
# * :body (String) The content of a discussion
|
|
253
|
+
# * :created_at (String) Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z
|
|
254
|
+
# * :position (Hash) Position when creating a diff note
|
|
255
|
+
# * :base_sha (String) Base commit SHA in the source branch
|
|
256
|
+
# * :start_sha (String) SHA referencing commit in target branch
|
|
257
|
+
# * :head_sha (String) SHA referencing HEAD of this merge request
|
|
258
|
+
# * :position_type (String) Type of the position reference', allowed values: 'text' or 'image'
|
|
259
|
+
# * :new_path (String) File path after change
|
|
260
|
+
# * :new_line (Integer) Line number after change (for 'text' diff notes)
|
|
261
|
+
# * :old_path (String) File path before change
|
|
262
|
+
# * :old_line (Integer) Line number before change (for 'text' diff notes)
|
|
263
|
+
# * :width (Integer) Width of the image (for 'image' diff notes)
|
|
264
|
+
# * :height (Integer) Height of the image (for 'image' diff notes)
|
|
265
|
+
# * :x (Integer) X coordinate (for 'image' diff notes)
|
|
266
|
+
# * :y (Integer) Y coordinate (for 'image' diff notes)
|
|
267
|
+
# @return [Gitlab::ObjectifiedHash] The created merge request discussion.
|
|
268
|
+
def create_merge_request_discussion(project, merge_request_id, options = {})
|
|
269
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions", body: options)
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
# Resolve a merge request discussion
|
|
273
|
+
#
|
|
274
|
+
# @example
|
|
275
|
+
# Gitlab.resolve_merge_request_discussion(5, 1, 1, true)
|
|
276
|
+
# Gitlab.resolve_merge_request_discussion('gitlab', 1, 1, false)
|
|
277
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
278
|
+
# @param [Integer] id The ID of a merge request.
|
|
279
|
+
# @param [Integer] discussion_id The ID of a discussion.
|
|
280
|
+
# @param [Hash] options A customizable set of options.
|
|
281
|
+
# @option options [Boolean] :resolved Resolve/unresolve the discussion.
|
|
282
|
+
# @return [Gitlab::ObjectifiedHash] The merge request discussion.
|
|
283
|
+
def resolve_merge_request_discussion(project, merge_request_id, discussion_id, options)
|
|
284
|
+
put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}", body: options)
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Add note to existing merge request discussion
|
|
288
|
+
#
|
|
289
|
+
# @example
|
|
290
|
+
# Gitlab.create_merge_request_discussion_note(5, 1, 1, note_id: 1, body: 'note')
|
|
291
|
+
# Gitlab.create_merge_request_discussion_note('gitlab', 1, 1, note_id: 1, body: 'note')
|
|
292
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
293
|
+
# @param [Integer] id The ID of a merge request.
|
|
294
|
+
# @param [Integer] discussion_id The ID of a discussion.
|
|
295
|
+
# @param [Hash] options A customizable set of options.
|
|
296
|
+
# @option options [Integer] :note_id The ID of a discussion note.
|
|
297
|
+
# @option options [String] :body The content of a discussion.
|
|
298
|
+
# @option options [String] :created_at Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z.
|
|
299
|
+
# @return [Gitlab::ObjectifiedHash] The merge request discussion note.
|
|
300
|
+
def create_merge_request_discussion_note(project, merge_request_id, discussion_id, options)
|
|
301
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes", body: options)
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# Modify an existing merge request discussion note
|
|
305
|
+
#
|
|
306
|
+
# @example
|
|
307
|
+
# Gitlab.update_merge_request_discussion_note(5, 1, 1, 1, body: 'note')
|
|
308
|
+
# Gitlab.update_merge_request_discussion_note('gitlab', 1, 1, 1, body: 'note')
|
|
309
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
310
|
+
# @param [Integer] id The ID of a merge request.
|
|
311
|
+
# @param [Integer] discussion_id The ID of a discussion.
|
|
312
|
+
# @param [Integer] note_id The ID of a discussion note.
|
|
313
|
+
# @param [Hash] options A customizable set of options.
|
|
314
|
+
# @option options [String] :body The content of a discussion.
|
|
315
|
+
# @option options [Boolean] :resolved Resolve/unresolve the note.
|
|
316
|
+
# @return [Gitlab::ObjectifiedHash] The merge request discussion note.
|
|
317
|
+
def update_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id, options)
|
|
318
|
+
put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}", body: options)
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# Delete a merge request discussion note
|
|
322
|
+
#
|
|
323
|
+
# @example
|
|
324
|
+
# Gitlab.delete_merge_request_discussion_note(5, 1, 1, 1)
|
|
325
|
+
# Gitlab.delete_merge_request_discussion_note('gitlab', 1, 1, 1)
|
|
326
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
327
|
+
# @param [Integer] id The ID of a merge request.
|
|
328
|
+
# @param [Integer] discussion_id The ID of a discussion.
|
|
329
|
+
# @param [Integer] note_id The ID of a discussion note.
|
|
330
|
+
# @return [Gitlab::ObjectifiedHash] An empty response.
|
|
331
|
+
def delete_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id)
|
|
332
|
+
delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}")
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
# Gets a list of merge request diff versions
|
|
336
|
+
#
|
|
337
|
+
# @example
|
|
338
|
+
# Gitlab.merge_request_versions(5, 1)
|
|
339
|
+
# Gitlab.merge_request_versions('gitlab', 1)
|
|
340
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
341
|
+
# @param [Integer] id The ID of a merge request.
|
|
342
|
+
# @return [Gitlab::ObjectifiedHash] A list of the merge request versions.
|
|
343
|
+
def merge_request_diff_versions(project, merge_request_id)
|
|
344
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/versions")
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# Gets the diff a single merge request diff version\
|
|
348
|
+
#
|
|
349
|
+
# @example
|
|
350
|
+
# Gitlab.merge_request_diff_version(5, 1, 1)
|
|
351
|
+
# Gitlab.merge_request_diff_version('gitlab', 1, 1)
|
|
352
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
353
|
+
# @param [Integer] id The ID of a merge request.
|
|
354
|
+
# @param [Integer] id The ID of a merge request diff version.
|
|
355
|
+
# @return [Gitlab::ObjectifiedHash] Record of the specific diff
|
|
356
|
+
def merge_request_diff_version(project, merge_request_id, version_id)
|
|
357
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/versions/#{version_id}")
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
# Rebase a merge request.
|
|
361
|
+
#
|
|
362
|
+
# @example
|
|
363
|
+
# Gitlab.rebase_merge_request(5, 42, { skip_ci: true })
|
|
364
|
+
#
|
|
365
|
+
# @param [Integer, String] project The ID or name of a project.
|
|
366
|
+
# @param [Integer] id The ID of a merge request.
|
|
367
|
+
# @param [Hash] options A customizable set of options.
|
|
368
|
+
# @option options [String] :skip_ci Set to true to skip creating a CI pipeline
|
|
369
|
+
# @return [Gitlab::ObjectifiedHash] Rebase progress status
|
|
370
|
+
def rebase_merge_request(project, id, options = {})
|
|
371
|
+
put("/projects/#{url_encode project}/merge_requests/#{id}/rebase", body: options)
|
|
372
|
+
end
|
|
145
373
|
end
|
|
146
374
|
end
|