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