gitlab 4.5.0 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/stale.yml +18 -0
- data/.rubocop_todo.yml +46 -0
- data/Gemfile +2 -0
- data/README.md +22 -22
- data/Rakefile +3 -5
- data/bin/console +1 -0
- data/exe/gitlab +5 -1
- data/gitlab.gemspec +9 -6
- data/lib/gitlab.rb +6 -3
- data/lib/gitlab/api.rb +5 -3
- data/lib/gitlab/cli.rb +11 -5
- data/lib/gitlab/cli_helpers.rb +31 -22
- data/lib/gitlab/client.rb +7 -8
- data/lib/gitlab/client/access_requests.rb +100 -93
- data/lib/gitlab/client/award_emojis.rb +127 -127
- data/lib/gitlab/client/boards.rb +82 -82
- data/lib/gitlab/client/branches.rb +89 -89
- data/lib/gitlab/client/build_variables.rb +117 -117
- data/lib/gitlab/client/builds.rb +98 -98
- data/lib/gitlab/client/commits.rb +154 -154
- data/lib/gitlab/client/deployments.rb +29 -29
- data/lib/gitlab/client/environments.rb +80 -80
- data/lib/gitlab/client/events.rb +54 -54
- data/lib/gitlab/client/group_milestones.rb +85 -86
- data/lib/gitlab/client/groups.rb +178 -178
- data/lib/gitlab/client/issues.rb +195 -196
- data/lib/gitlab/client/jobs.rb +150 -150
- data/lib/gitlab/client/keys.rb +14 -14
- data/lib/gitlab/client/labels.rb +79 -79
- data/lib/gitlab/client/merge_request_approvals.rb +102 -102
- data/lib/gitlab/client/merge_requests.rb +281 -256
- data/lib/gitlab/client/milestones.rb +85 -85
- data/lib/gitlab/client/namespaces.rb +18 -18
- data/lib/gitlab/client/notes.rb +260 -260
- data/lib/gitlab/client/pipeline_schedules.rb +123 -123
- data/lib/gitlab/client/pipeline_triggers.rb +93 -93
- data/lib/gitlab/client/pipelines.rb +62 -62
- data/lib/gitlab/client/projects.rb +526 -505
- data/lib/gitlab/client/repositories.rb +68 -55
- data/lib/gitlab/client/repository_files.rb +103 -103
- data/lib/gitlab/client/runners.rb +113 -115
- data/lib/gitlab/client/services.rb +46 -45
- data/lib/gitlab/client/sidekiq.rb +32 -32
- data/lib/gitlab/client/snippets.rb +86 -86
- data/lib/gitlab/client/system_hooks.rb +57 -57
- data/lib/gitlab/client/tags.rb +87 -88
- data/lib/gitlab/client/todos.rb +41 -41
- data/lib/gitlab/client/users.rb +242 -228
- data/lib/gitlab/client/versions.rb +16 -0
- data/lib/gitlab/configuration.rb +7 -5
- data/lib/gitlab/error.rb +3 -1
- data/lib/gitlab/file_response.rb +4 -2
- data/lib/gitlab/help.rb +9 -9
- data/lib/gitlab/objectified_hash.rb +5 -4
- data/lib/gitlab/page_links.rb +9 -7
- data/lib/gitlab/paginated_response.rb +14 -4
- data/lib/gitlab/request.rb +8 -5
- data/lib/gitlab/shell.rb +6 -4
- data/lib/gitlab/shell_history.rb +7 -5
- data/lib/gitlab/version.rb +3 -1
- metadata +8 -5
@@ -1,110 +1,110 @@
|
|
1
|
-
|
2
|
-
# Defines methods related to MR Approvals.
|
3
|
-
# @see https://docs.gitlab.com/ee/api/merge_request_approvals.html
|
4
|
-
module MergeRequestApprovals
|
5
|
-
# Gets MR Approval Configuration for a project
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Gitlab.project_merge_request_approvals(1)
|
9
|
-
#
|
10
|
-
# @param [Integer] project The ID of a project.
|
11
|
-
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
12
|
-
def project_merge_request_approvals(project)
|
13
|
-
get("/projects/#{url_encode project}/approvals")
|
14
|
-
end
|
1
|
+
# frozen_string_literal: true
|
15
2
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
3
|
+
# Defines methods related to MR Approvals.
|
4
|
+
# @see https://docs.gitlab.com/ee/api/merge_request_approvals.html
|
5
|
+
module MergeRequestApprovals
|
6
|
+
# Gets MR Approval Configuration for a project
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# Gitlab.project_merge_request_approvals(1)
|
10
|
+
#
|
11
|
+
# @param [Integer] project The ID of a project.
|
12
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
13
|
+
def project_merge_request_approvals(project)
|
14
|
+
get("/projects/#{url_encode project}/approvals")
|
15
|
+
end
|
16
|
+
|
17
|
+
# Change MR Approval Configuration for a project
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3})
|
21
|
+
# Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, reset_approvals_on_push: true})
|
22
|
+
# Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, disable_overriding_approvers_per_merge_request: false})
|
23
|
+
#
|
24
|
+
# @param [Integer] project(required) The ID of a project.
|
25
|
+
# @option options [Integer] :approvals_before_merge(optional) How many approvals are required before an MR can be merged
|
26
|
+
# @option options [Boolean] :reset_approvals_on_push(optional) Reset approvals on a new push
|
27
|
+
# @option options [Boolean] :disable_overriding_approvers_per_merge_request(optional) Allow/Disallow overriding approvers per MR
|
28
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
29
|
+
def edit_project_merge_request_approvals(project, options = {})
|
30
|
+
post("/projects/#{url_encode project}/approvals", body: options)
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
33
|
+
# Change allowed approvers and approver groups for a project
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Gitlab.edit_project_approvers(1, {approver_ids: [5], approver_groups: [1]})
|
37
|
+
#
|
38
|
+
# @param [Integer] project(required) The ID of a project.
|
39
|
+
# @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs
|
40
|
+
# @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs
|
41
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
42
|
+
def edit_project_approvers(project, options = {})
|
43
|
+
put("/projects/#{url_encode project}/approvals", body: options)
|
44
|
+
end
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
46
|
+
# Get Configuration for approvals on a specific Merge Request.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# Gitlab.merge_request_approvals(1, 5)
|
50
|
+
#
|
51
|
+
# @param [Integer] project(required) The ID of a project.
|
52
|
+
# @param [Integer] merge_request(required) The IID of a merge_request.
|
53
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the merge request
|
54
|
+
def merge_request_approvals(project, merge_request)
|
55
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals")
|
56
|
+
end
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
58
|
+
# Change configuration for approvals on a specific merge request.
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# Gitlab.edit_merge_request_approvals(1, 5, approvals_required: 2)
|
62
|
+
#
|
63
|
+
# @param [Integer] project(required) The ID of a project.
|
64
|
+
# @param [Integer] merge_request(required) The IID of a merge_request.
|
65
|
+
# @option options [Integer] :approvals_required(required) Approvals required before MR can be merged
|
66
|
+
# @return [Gitlab::ObjectifiedHash] Updated MR approval configuration information about the merge request
|
67
|
+
def edit_merge_request_approvals(project, merge_request, options = {})
|
68
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options)
|
69
|
+
end
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
71
|
+
# Change allowed approvers and approver groups for a merge request
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# Gitlab.edit_merge_request_approvers(1, 5, {approver_ids: [5], approver_groups: [1]})
|
75
|
+
#
|
76
|
+
# @param [Integer] project(required) The ID of a project.
|
77
|
+
# @param [Integer] merge_request(required) The IID of a merge_request.
|
78
|
+
# @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs
|
79
|
+
# @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs
|
80
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
81
|
+
def edit_merge_request_approvers(project, merge_request, options = {})
|
82
|
+
put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options)
|
83
|
+
end
|
83
84
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
85
|
+
# Approve a merge request
|
86
|
+
#
|
87
|
+
# @example
|
88
|
+
# Gitlab.approve_merge_request(1, 5)
|
89
|
+
# Gitlab.approve_merge_request(1, 5, sha: 'fe678da')
|
90
|
+
#
|
91
|
+
# @param [Integer] project(required) The ID of a project.
|
92
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
93
|
+
# @option options [String] :sha(optional) The HEAD of the MR
|
94
|
+
# @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project
|
95
|
+
def approve_merge_request(project, merge_request, options = {})
|
96
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approve", body: options)
|
97
|
+
end
|
97
98
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
99
|
+
# Unapprove a merge request
|
100
|
+
#
|
101
|
+
# @example
|
102
|
+
# Gitlab.unapprove_merge_request(1, 5)
|
103
|
+
#
|
104
|
+
# @param [Integer] project(required) The ID of a project.
|
105
|
+
# @param [Integer] merge_request(required) The IID of a merge request.
|
106
|
+
# @return [void] This API call returns an empty response body.
|
107
|
+
def unapprove_merge_request(project, merge_request)
|
108
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove")
|
109
109
|
end
|
110
|
-
end
|
110
|
+
end
|
@@ -1,275 +1,300 @@
|
|
1
|
-
|
2
|
-
# Defines methods related to merge requests.
|
3
|
-
# @see https://docs.gitlab.com/ce/api/merge_requests.html
|
4
|
-
module MergeRequests
|
5
|
-
# Gets a list of all of the merge requests the authenticated user has access to.
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Gitlab.user_merge_requests
|
9
|
-
# Gitlab.user_merge_requests(state: :opened, scope: :all)
|
10
|
-
#
|
11
|
-
# @param [Hash] options A customizable set of options.
|
12
|
-
# @return [Array<Gitlab::ObjectifiedHash>]
|
13
|
-
def user_merge_requests(options = {})
|
14
|
-
get('/merge_requests', query: options)
|
15
|
-
end
|
1
|
+
# frozen_string_literal: true
|
16
2
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
3
|
+
# Defines methods related to merge requests.
|
4
|
+
# @see https://docs.gitlab.com/ce/api/merge_requests.html
|
5
|
+
module MergeRequests
|
6
|
+
# Gets a list of all of the merge requests the authenticated user has access to.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# Gitlab.user_merge_requests
|
10
|
+
# Gitlab.user_merge_requests(state: :opened, scope: :all)
|
11
|
+
#
|
12
|
+
# @param [Hash] options A customizable set of options.
|
13
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
14
|
+
def user_merge_requests(options = {})
|
15
|
+
get('/merge_requests', query: options)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gets a list of project merge requests.
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# Gitlab.merge_requests(5)
|
22
|
+
# Gitlab.merge_requests(5, { per_page: 40 })
|
23
|
+
#
|
24
|
+
# @param [Integer, String] project The ID or name of a project.
|
25
|
+
# @param [Hash] options A customizable set of options.
|
26
|
+
# @option options [Integer] :page The page number.
|
27
|
+
# @option options [Integer] :per_page The number of results per page.
|
28
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
29
|
+
def merge_requests(project, options = {})
|
30
|
+
get("/projects/#{url_encode project}/merge_requests", query: options)
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
# Gets a single merge request.
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Gitlab.merge_request(5, 36)
|
37
|
+
#
|
38
|
+
# @param [Integer, String] project The ID or name of a project.
|
39
|
+
# @param [Integer] id The ID of a merge request.
|
40
|
+
# @return <Gitlab::ObjectifiedHash]
|
41
|
+
def merge_request(project, id)
|
42
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}")
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
45
|
+
# Creates a merge request.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# Gitlab.create_merge_request(5, 'New merge request',
|
49
|
+
# { source_branch: 'source_branch', target_branch: 'target_branch' })
|
50
|
+
# Gitlab.create_merge_request(5, 'New merge request',
|
51
|
+
# { source_branch: 'source_branch', target_branch: 'target_branch', assignee_id: 42 })
|
52
|
+
#
|
53
|
+
# @param [Integer, String] project The ID or name of a project.
|
54
|
+
# @param [String] title The title of a merge request.
|
55
|
+
# @param [Hash] options A customizable set of options.
|
56
|
+
# @option options [String] :source_branch (required) The source branch name.
|
57
|
+
# @option options [String] :target_branch (required) The target branch name.
|
58
|
+
# @option options [Integer] :assignee_id (optional) The ID of a user to assign merge request.
|
59
|
+
# @option options [Integer] :target_project_id (optional) The target project ID.
|
60
|
+
# @option options [String] :labels (optional) Labels as a comma-separated list.
|
61
|
+
# @return [Gitlab::ObjectifiedHash] Information about created merge request.
|
62
|
+
def create_merge_request(project, title, options = {})
|
63
|
+
body = { title: title }.merge(options)
|
64
|
+
post("/projects/#{url_encode project}/merge_requests", body: body)
|
65
|
+
end
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
67
|
+
# Updates a merge request.
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Gitlab.update_merge_request(5, 42, { title: 'New title' })
|
71
|
+
#
|
72
|
+
# @param [Integer, String] project The ID or name of a project.
|
73
|
+
# @param [Integer] id The ID of a merge request.
|
74
|
+
# @param [Hash] options A customizable set of options.
|
75
|
+
# @option options [String] :title The title of a merge request.
|
76
|
+
# @option options [String] :source_branch The source branch name.
|
77
|
+
# @option options [String] :target_branch The target branch name.
|
78
|
+
# @option options [Integer] :assignee_id The ID of a user to assign merge request.
|
79
|
+
# @option options [String] :state_event New state (close|reopen|merge).
|
80
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
81
|
+
def update_merge_request(project, id, options = {})
|
82
|
+
put("/projects/#{url_encode project}/merge_requests/#{id}", body: options)
|
83
|
+
end
|
83
84
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
85
|
+
# Accepts a merge request.
|
86
|
+
#
|
87
|
+
# @example
|
88
|
+
# Gitlab.accept_merge_request(5, 42, { merge_commit_message: 'Nice!' })
|
89
|
+
#
|
90
|
+
# @param [Integer, String] project The ID or name of a project.
|
91
|
+
# @param [Integer] id The ID of a merge request.
|
92
|
+
# @param [Hash] options A customizable set of options.
|
93
|
+
# @option options [String] :merge_commit_message Custom merge commit message
|
94
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
95
|
+
def accept_merge_request(project, id, options = {})
|
96
|
+
put("/projects/#{url_encode project}/merge_requests/#{id}/merge", body: options)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Gets the changes of a merge request.
|
100
|
+
#
|
101
|
+
# @example
|
102
|
+
# Gitlab.merge_request_changes(5, 1)
|
103
|
+
#
|
104
|
+
# @param [Integer, String] project The ID or name of a project.
|
105
|
+
# @param [Integer] id The ID of a merge request.
|
106
|
+
# @return [Gitlab::ObjectifiedHash] The merge request's changes.
|
107
|
+
def merge_request_changes(project, id)
|
108
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}/changes")
|
109
|
+
end
|
110
|
+
|
111
|
+
# Gets the commits of a merge request.
|
112
|
+
#
|
113
|
+
# @example
|
114
|
+
# Gitlab.merge_request_commits(5, 1)
|
115
|
+
#
|
116
|
+
# @param [Integer, String] project The ID or name of a project.
|
117
|
+
# @param [Integer] id The ID of a merge request.
|
118
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The merge request's commits.
|
119
|
+
def merge_request_commits(project, id)
|
120
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}/commits")
|
121
|
+
end
|
97
122
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
123
|
+
# List issues that will close on merge
|
124
|
+
#
|
125
|
+
# @example
|
126
|
+
# Gitlab.merge_request_closes_issues(5, 1)
|
127
|
+
#
|
128
|
+
# @param [Integer] project The ID of a project
|
129
|
+
# @param [Integer] iid The internal ID of a merge request
|
130
|
+
def merge_request_closes_issues(project_id, merge_request_iid)
|
131
|
+
get("/projects/#{project_id}/merge_requests/#{merge_request_iid}/closes_issues")
|
132
|
+
end
|
109
133
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
134
|
+
# Subscribes to a merge request.
|
135
|
+
#
|
136
|
+
# @example
|
137
|
+
# Gitlab.subscribe_to_merge_request(5, 1)
|
138
|
+
# Gitlab.subscribe_to_merge_request('gitlab', 1)
|
139
|
+
#
|
140
|
+
# @param [Integer, String] project The ID or name of a project.
|
141
|
+
# @param [Integer] id The ID of a merge request.
|
142
|
+
# @return [Gitlab::ObjectifiedHash] Information about subscribed merge request.
|
143
|
+
def subscribe_to_merge_request(project, id)
|
144
|
+
post("/projects/#{url_encode project}/merge_requests/#{id}/subscribe")
|
145
|
+
end
|
121
146
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
147
|
+
# Unsubscribes from a merge request.
|
148
|
+
#
|
149
|
+
# @example
|
150
|
+
# Gitlab.unsubscribe_from_merge_request(5, 1)
|
151
|
+
# Gitlab.unsubscribe_from_merge_request('gitlab', 1)
|
152
|
+
#
|
153
|
+
# @param [Integer, String] project The ID or name of a project.
|
154
|
+
# @param [Integer] id The ID of a merge request.
|
155
|
+
# @return [Gitlab::ObjectifiedHash] Information about unsubscribed merge request.
|
156
|
+
def unsubscribe_from_merge_request(project, id)
|
157
|
+
post("/projects/#{url_encode project}/merge_requests/#{id}/unsubscribe")
|
158
|
+
end
|
132
159
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
end
|
160
|
+
# List project merge request discussions
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
# Gitlab.merge_request_discussions(5, 1)
|
164
|
+
# Gitlab.merge_request_discussions('gitlab', 1)
|
165
|
+
# @param [Integer, String] project The ID or name of a project.
|
166
|
+
# @param [Integer] id The ID of a merge request.
|
167
|
+
# @return [Gitlab::ObjectifiedHash] List of the merge request discussions.
|
168
|
+
def merge_request_discussions(project, merge_request_id)
|
169
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions")
|
170
|
+
end
|
145
171
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
172
|
+
# Get single merge request discussion
|
173
|
+
#
|
174
|
+
# @example
|
175
|
+
# Gitlab.merge_request_discussion(5, 1, 1)
|
176
|
+
# Gitlab.merge_request_discussion('gitlab', 1, 1)
|
177
|
+
# @param [Integer, String] project The ID or name of a project.
|
178
|
+
# @param [Integer] id The ID of a merge request.
|
179
|
+
# @param [Integer] discussion_id The ID of a discussion.
|
180
|
+
# @return [Gitlab::ObjectifiedHash] The merge request discussion.
|
181
|
+
def merge_request_discussion(project, merge_request_id, discussion_id)
|
182
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}")
|
183
|
+
end
|
158
184
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
185
|
+
# Create new merge request discussion
|
186
|
+
#
|
187
|
+
# @example
|
188
|
+
# Gitlab.create_merge_request_discussion(5, 1, body: 'discuss')
|
189
|
+
# Gitlab.create_merge_request_discussion('gitlab', 1, body: 'discuss')
|
190
|
+
# @param [Integer, String] project The ID or name of a project.
|
191
|
+
# @param [Integer] id The ID of a merge request.
|
192
|
+
# @param [Hash] options A customizable set of options.
|
193
|
+
# * :body (String) The content of a discussion
|
194
|
+
# * :created_at (String) Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z
|
195
|
+
# * :position (Hash) Position when creating a diff note
|
196
|
+
# * :base_sha (String) Base commit SHA in the source branch
|
197
|
+
# * :start_sha (String) SHA referencing commit in target branch
|
198
|
+
# * :head_sha (String) SHA referencing HEAD of this merge request
|
199
|
+
# * :position_type (String) Type of the position reference', allowed values: 'text' or 'image'
|
200
|
+
# * :new_path (String) File path after change
|
201
|
+
# * :new_line (Integer) Line number after change (for 'text' diff notes)
|
202
|
+
# * :old_path (String) File path before change
|
203
|
+
# * :old_line (Integer) Line number before change (for 'text' diff notes)
|
204
|
+
# * :width (Integer) Width of the image (for 'image' diff notes)
|
205
|
+
# * :height (Integer) Height of the image (for 'image' diff notes)
|
206
|
+
# * :x (Integer) X coordinate (for 'image' diff notes)
|
207
|
+
# * :y (Integer) Y coordinate (for 'image' diff notes)
|
208
|
+
# @return [Gitlab::ObjectifiedHash] The created merge request discussion.
|
209
|
+
def create_merge_request_discussion(project, merge_request_id, options = {})
|
210
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions", body: options)
|
211
|
+
end
|
170
212
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
213
|
+
# Resolve a merge request discussion
|
214
|
+
#
|
215
|
+
# @example
|
216
|
+
# Gitlab.resolve_merge_request_discussion(5, 1, 1, true)
|
217
|
+
# Gitlab.resolve_merge_request_discussion('gitlab', 1, 1, false)
|
218
|
+
# @param [Integer, String] project The ID or name of a project.
|
219
|
+
# @param [Integer] id The ID of a merge request.
|
220
|
+
# @param [Integer] discussion_id The ID of a discussion.
|
221
|
+
# @param [Hash] options A customizable set of options.
|
222
|
+
# @option options [Boolean] :resolved Resolve/unresolve the discussion.
|
223
|
+
# @return [Gitlab::ObjectifiedHash] The merge request discussion.
|
224
|
+
def resolve_merge_request_discussion(project, merge_request_id, discussion_id, options)
|
225
|
+
put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}", body: options)
|
226
|
+
end
|
183
227
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
# * :new_line (Integer) Line number after change (for 'text' diff notes)
|
201
|
-
# * :old_path (String) File path before change
|
202
|
-
# * :old_line (Integer) Line number before change (for 'text' diff notes)
|
203
|
-
# * :width (Integer) Width of the image (for 'image' diff notes)
|
204
|
-
# * :height (Integer) Height of the image (for 'image' diff notes)
|
205
|
-
# * :x (Integer) X coordinate (for 'image' diff notes)
|
206
|
-
# * :y (Integer) Y coordinate (for 'image' diff notes)
|
207
|
-
# @return [Gitlab::ObjectifiedHash] The created merge request discussion.
|
208
|
-
def create_merge_request_discussion(project, merge_request_id, options={})
|
209
|
-
post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions", body: options)
|
210
|
-
end
|
228
|
+
# Add note to existing merge request discussion
|
229
|
+
#
|
230
|
+
# @example
|
231
|
+
# Gitlab.create_merge_request_discussion_note(5, 1, 1, note_id: 1, body: 'note')
|
232
|
+
# Gitlab.create_merge_request_discussion_note('gitlab', 1, 1, note_id: 1, body: 'note')
|
233
|
+
# @param [Integer, String] project The ID or name of a project.
|
234
|
+
# @param [Integer] id The ID of a merge request.
|
235
|
+
# @param [Integer] discussion_id The ID of a discussion.
|
236
|
+
# @param [Hash] options A customizable set of options.
|
237
|
+
# @option options [Integer] :note_id The ID of a discussion note.
|
238
|
+
# @option options [String] :body The content of a discussion.
|
239
|
+
# @option options [String] :created_at Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z.
|
240
|
+
# @return [Gitlab::ObjectifiedHash] The merge request discussion note.
|
241
|
+
def create_merge_request_discussion_note(project, merge_request_id, discussion_id, options)
|
242
|
+
post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes", body: options)
|
243
|
+
end
|
211
244
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
245
|
+
# Modify an existing merge request discussion note
|
246
|
+
#
|
247
|
+
# @example
|
248
|
+
# Gitlab.update_merge_request_discussion_note(5, 1, 1, 1, body: 'note')
|
249
|
+
# Gitlab.update_merge_request_discussion_note('gitlab', 1, 1, 1, body: 'note')
|
250
|
+
# @param [Integer, String] project The ID or name of a project.
|
251
|
+
# @param [Integer] id The ID of a merge request.
|
252
|
+
# @param [Integer] discussion_id The ID of a discussion.
|
253
|
+
# @param [Integer] note_id The ID of a discussion note.
|
254
|
+
# @param [Hash] options A customizable set of options.
|
255
|
+
# @option options [String] :body The content of a discussion.
|
256
|
+
# @option options [Boolean] :resolved Resolve/unresolve the note.
|
257
|
+
# @return [Gitlab::ObjectifiedHash] The merge request discussion note.
|
258
|
+
def update_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id, options)
|
259
|
+
put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}", body: options)
|
260
|
+
end
|
226
261
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
def create_merge_request_discussion_note(project, merge_request_id, discussion_id, options)
|
241
|
-
post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes", body: options)
|
242
|
-
end
|
262
|
+
# Delete a merge request discussion note
|
263
|
+
#
|
264
|
+
# @example
|
265
|
+
# Gitlab.delete_merge_request_discussion_note(5, 1, 1, 1)
|
266
|
+
# Gitlab.delete_merge_request_discussion_note('gitlab', 1, 1, 1)
|
267
|
+
# @param [Integer, String] project The ID or name of a project.
|
268
|
+
# @param [Integer] id The ID of a merge request.
|
269
|
+
# @param [Integer] discussion_id The ID of a discussion.
|
270
|
+
# @param [Integer] note_id The ID of a discussion note.
|
271
|
+
# @return [Gitlab::ObjectifiedHash] An empty response.
|
272
|
+
def delete_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id)
|
273
|
+
delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}")
|
274
|
+
end
|
243
275
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
# @option options [Boolean] :resolved Resolve/unresolve the note.
|
256
|
-
# @return [Gitlab::ObjectifiedHash] The merge request discussion note.
|
257
|
-
def update_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id, options)
|
258
|
-
put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}", body: options)
|
259
|
-
end
|
276
|
+
# Gets a list of merge request diff versions
|
277
|
+
#
|
278
|
+
# @example
|
279
|
+
# Gitlab.merge_request_versions(5, 1)
|
280
|
+
# Gitlab.merge_request_versions('gitlab', 1)
|
281
|
+
# @param [Integer, String] project The ID or name of a project.
|
282
|
+
# @param [Integer] id The ID of a merge request.
|
283
|
+
# @return [Gitlab::ObjectifiedHash] A list of the merge request versions.
|
284
|
+
def merge_request_diff_versions(project, merge_request_id)
|
285
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/versions")
|
286
|
+
end
|
260
287
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}")
|
273
|
-
end
|
288
|
+
# Gets the diff a single merge request diff version\
|
289
|
+
#
|
290
|
+
# @example
|
291
|
+
# Gitlab.merge_request_diff_version(5, 1, 1)
|
292
|
+
# Gitlab.merge_request_diff_version('gitlab', 1, 1)
|
293
|
+
# @param [Integer, String] project The ID or name of a project.
|
294
|
+
# @param [Integer] id The ID of a merge request.
|
295
|
+
# @param [Integer] id The ID of a merge request diff version.
|
296
|
+
# @return [Gitlab::ObjectifiedHash] Record of the specific diff
|
297
|
+
def merge_request_diff_version(project, merge_request_id, version_id)
|
298
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/versions/#{version_id}")
|
274
299
|
end
|
275
300
|
end
|