fs-gitlab 4.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +270 -0
- data/LICENSE.txt +24 -0
- data/README.md +260 -0
- data/exe/gitlab +11 -0
- data/lib/gitlab/api.rb +24 -0
- data/lib/gitlab/cli.rb +89 -0
- data/lib/gitlab/cli_helpers.rb +243 -0
- 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 +137 -0
- data/lib/gitlab/client/boards.rb +146 -0
- data/lib/gitlab/client/branches.rb +135 -0
- data/lib/gitlab/client/broadcast_messages.rb +75 -0
- data/lib/gitlab/client/build_variables.rb +135 -0
- data/lib/gitlab/client/builds.rb +108 -0
- data/lib/gitlab/client/commits.rb +216 -0
- data/lib/gitlab/client/container_registry.rb +85 -0
- data/lib/gitlab/client/deployments.rb +34 -0
- data/lib/gitlab/client/environments.rb +89 -0
- 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 +358 -0
- data/lib/gitlab/client/issue_links.rb +48 -0
- data/lib/gitlab/client/issues.rb +231 -0
- data/lib/gitlab/client/jobs.rb +250 -0
- data/lib/gitlab/client/keys.rb +29 -0
- data/lib/gitlab/client/labels.rb +88 -0
- 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 +386 -0
- data/lib/gitlab/client/milestones.rb +106 -0
- data/lib/gitlab/client/namespaces.rb +22 -0
- data/lib/gitlab/client/notes.rb +313 -0
- data/lib/gitlab/client/packages.rb +95 -0
- data/lib/gitlab/client/pipeline_schedules.rb +147 -0
- data/lib/gitlab/client/pipeline_triggers.rb +103 -0
- data/lib/gitlab/client/pipelines.rb +105 -0
- 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 +708 -0
- data/lib/gitlab/client/protected_tags.rb +59 -0
- data/lib/gitlab/client/remote_mirrors.rb +51 -0
- data/lib/gitlab/client/repositories.rb +113 -0
- data/lib/gitlab/client/repository_files.rb +131 -0
- 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 +211 -0
- data/lib/gitlab/client/search.rb +66 -0
- data/lib/gitlab/client/services.rb +53 -0
- data/lib/gitlab/client/sidekiq.rb +39 -0
- data/lib/gitlab/client/snippets.rb +95 -0
- data/lib/gitlab/client/system_hooks.rb +64 -0
- data/lib/gitlab/client/tags.rb +97 -0
- data/lib/gitlab/client/templates.rb +100 -0
- data/lib/gitlab/client/todos.rb +46 -0
- data/lib/gitlab/client/user_snippets.rb +114 -0
- data/lib/gitlab/client/users.rb +397 -0
- data/lib/gitlab/client/versions.rb +18 -0
- data/lib/gitlab/client/wikis.rb +79 -0
- data/lib/gitlab/client.rb +95 -0
- data/lib/gitlab/configuration.rb +57 -0
- data/lib/gitlab/error.rb +170 -0
- data/lib/gitlab/file_response.rb +48 -0
- data/lib/gitlab/help.rb +94 -0
- data/lib/gitlab/objectified_hash.rb +51 -0
- data/lib/gitlab/page_links.rb +35 -0
- data/lib/gitlab/paginated_response.rb +110 -0
- data/lib/gitlab/request.rb +109 -0
- data/lib/gitlab/shell.rb +83 -0
- data/lib/gitlab/shell_history.rb +57 -0
- data/lib/gitlab/version.rb +5 -0
- data/lib/gitlab.rb +56 -0
- metadata +204 -0
@@ -0,0 +1,386 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
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
|
18
|
+
|
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
|
33
|
+
|
34
|
+
# Gets a single merge request.
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# Gitlab.merge_request(5, 36)
|
38
|
+
# Gitlab.merge_request(5, 36, { include_diverged_commits_count: true })
|
39
|
+
#
|
40
|
+
# @param [Integer, String] project The ID or name of a project.
|
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.
|
45
|
+
# @return <Gitlab::ObjectifiedHash]
|
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")
|
91
|
+
end
|
92
|
+
|
93
|
+
# Creates a merge request.
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# Gitlab.create_merge_request(5, 'New merge request',
|
97
|
+
# { source_branch: 'source_branch', target_branch: 'target_branch' })
|
98
|
+
# Gitlab.create_merge_request(5, 'New merge request',
|
99
|
+
# { source_branch: 'source_branch', target_branch: 'target_branch', assignee_id: 42 })
|
100
|
+
#
|
101
|
+
# @param [Integer, String] project The ID or name of a project.
|
102
|
+
# @param [String] title The title of a merge request.
|
103
|
+
# @param [Hash] options A customizable set of options.
|
104
|
+
# @option options [String] :source_branch (required) The source branch name.
|
105
|
+
# @option options [String] :target_branch (required) The target branch name.
|
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.
|
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
|
115
|
+
# @return [Gitlab::ObjectifiedHash] Information about created merge request.
|
116
|
+
def create_merge_request(project, title, options = {})
|
117
|
+
body = { title: title }.merge(options)
|
118
|
+
post("/projects/#{url_encode project}/merge_requests", body: body)
|
119
|
+
end
|
120
|
+
|
121
|
+
# Updates a merge request.
|
122
|
+
#
|
123
|
+
# @example
|
124
|
+
# Gitlab.update_merge_request(5, 42, { title: 'New title' })
|
125
|
+
#
|
126
|
+
# @param [Integer, String] project The ID or name of a project.
|
127
|
+
# @param [Integer] id The ID of a merge request.
|
128
|
+
# @param [Hash] options A customizable set of options.
|
129
|
+
# @option options [String] :title The title of a merge request.
|
130
|
+
# @option options [String] :source_branch The source branch name.
|
131
|
+
# @option options [String] :target_branch The target branch name.
|
132
|
+
# @option options [Integer] :assignee_id The ID of a user to assign merge request.
|
133
|
+
# @option options [String] :state_event New state (close|reopen|merge).
|
134
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
135
|
+
def update_merge_request(project, id, options = {})
|
136
|
+
put("/projects/#{url_encode project}/merge_requests/#{id}", body: options)
|
137
|
+
end
|
138
|
+
|
139
|
+
# Accepts a merge request.
|
140
|
+
#
|
141
|
+
# @example
|
142
|
+
# Gitlab.accept_merge_request(5, 42, { merge_commit_message: 'Nice!' })
|
143
|
+
#
|
144
|
+
# @param [Integer, String] project The ID or name of a project.
|
145
|
+
# @param [Integer] id The ID of a merge request.
|
146
|
+
# @param [Hash] options A customizable set of options.
|
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
|
153
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
154
|
+
def accept_merge_request(project, id, options = {})
|
155
|
+
put("/projects/#{url_encode project}/merge_requests/#{id}/merge", body: options)
|
156
|
+
end
|
157
|
+
|
158
|
+
# Gets the changes of a merge request.
|
159
|
+
#
|
160
|
+
# @example
|
161
|
+
# Gitlab.merge_request_changes(5, 1)
|
162
|
+
#
|
163
|
+
# @param [Integer, String] project The ID or name of a project.
|
164
|
+
# @param [Integer] id The ID of a merge request.
|
165
|
+
# @return [Gitlab::ObjectifiedHash] The merge request's changes.
|
166
|
+
def merge_request_changes(project, id)
|
167
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}/changes")
|
168
|
+
end
|
169
|
+
|
170
|
+
# Gets the commits of a merge request.
|
171
|
+
#
|
172
|
+
# @example
|
173
|
+
# Gitlab.merge_request_commits(5, 1)
|
174
|
+
#
|
175
|
+
# @param [Integer, String] project The ID or name of a project.
|
176
|
+
# @param [Integer] id The ID of a merge request.
|
177
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The merge request's commits.
|
178
|
+
def merge_request_commits(project, id)
|
179
|
+
get("/projects/#{url_encode project}/merge_requests/#{id}/commits")
|
180
|
+
end
|
181
|
+
|
182
|
+
# List issues that will close on merge
|
183
|
+
#
|
184
|
+
# @example
|
185
|
+
# Gitlab.merge_request_closes_issues(5, 1)
|
186
|
+
#
|
187
|
+
# @param [Integer] project The ID of a project
|
188
|
+
# @param [Integer] iid The internal ID of a merge request
|
189
|
+
def merge_request_closes_issues(project_id, merge_request_iid)
|
190
|
+
get("/projects/#{url_encode project_id}/merge_requests/#{merge_request_iid}/closes_issues")
|
191
|
+
end
|
192
|
+
|
193
|
+
# Subscribes to a merge request.
|
194
|
+
#
|
195
|
+
# @example
|
196
|
+
# Gitlab.subscribe_to_merge_request(5, 1)
|
197
|
+
# Gitlab.subscribe_to_merge_request('gitlab', 1)
|
198
|
+
#
|
199
|
+
# @param [Integer, String] project The ID or name of a project.
|
200
|
+
# @param [Integer] id The ID of a merge request.
|
201
|
+
# @return [Gitlab::ObjectifiedHash] Information about subscribed merge request.
|
202
|
+
def subscribe_to_merge_request(project, id)
|
203
|
+
post("/projects/#{url_encode project}/merge_requests/#{id}/subscribe")
|
204
|
+
end
|
205
|
+
|
206
|
+
# Unsubscribes from a merge request.
|
207
|
+
#
|
208
|
+
# @example
|
209
|
+
# Gitlab.unsubscribe_from_merge_request(5, 1)
|
210
|
+
# Gitlab.unsubscribe_from_merge_request('gitlab', 1)
|
211
|
+
#
|
212
|
+
# @param [Integer, String] project The ID or name of a project.
|
213
|
+
# @param [Integer] id The ID of a merge request.
|
214
|
+
# @return [Gitlab::ObjectifiedHash] Information about unsubscribed merge request.
|
215
|
+
def unsubscribe_from_merge_request(project, id)
|
216
|
+
post("/projects/#{url_encode project}/merge_requests/#{id}/unsubscribe")
|
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
|
+
# Delete a merge request
|
336
|
+
#
|
337
|
+
# @example
|
338
|
+
# Gitlab.delete_merge_request(5, 1)
|
339
|
+
# Gitlab.delete_merge_request('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] An empty response.
|
343
|
+
def delete_merge_request(project, merge_request_id)
|
344
|
+
delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}")
|
345
|
+
end
|
346
|
+
|
347
|
+
# Gets a list of merge request diff versions
|
348
|
+
#
|
349
|
+
# @example
|
350
|
+
# Gitlab.merge_request_versions(5, 1)
|
351
|
+
# Gitlab.merge_request_versions('gitlab', 1)
|
352
|
+
# @param [Integer, String] project The ID or name of a project.
|
353
|
+
# @param [Integer] id The ID of a merge request.
|
354
|
+
# @return [Gitlab::ObjectifiedHash] A list of the merge request versions.
|
355
|
+
def merge_request_diff_versions(project, merge_request_id)
|
356
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/versions")
|
357
|
+
end
|
358
|
+
|
359
|
+
# Gets the diff a single merge request diff version\
|
360
|
+
#
|
361
|
+
# @example
|
362
|
+
# Gitlab.merge_request_diff_version(5, 1, 1)
|
363
|
+
# Gitlab.merge_request_diff_version('gitlab', 1, 1)
|
364
|
+
# @param [Integer, String] project The ID or name of a project.
|
365
|
+
# @param [Integer] id The ID of a merge request.
|
366
|
+
# @param [Integer] id The ID of a merge request diff version.
|
367
|
+
# @return [Gitlab::ObjectifiedHash] Record of the specific diff
|
368
|
+
def merge_request_diff_version(project, merge_request_id, version_id)
|
369
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/versions/#{version_id}")
|
370
|
+
end
|
371
|
+
|
372
|
+
# Rebase a merge request.
|
373
|
+
#
|
374
|
+
# @example
|
375
|
+
# Gitlab.rebase_merge_request(5, 42, { skip_ci: true })
|
376
|
+
#
|
377
|
+
# @param [Integer, String] project The ID or name of a project.
|
378
|
+
# @param [Integer] id The ID of a merge request.
|
379
|
+
# @param [Hash] options A customizable set of options.
|
380
|
+
# @option options [String] :skip_ci Set to true to skip creating a CI pipeline
|
381
|
+
# @return [Gitlab::ObjectifiedHash] Rebase progress status
|
382
|
+
def rebase_merge_request(project, id, options = {})
|
383
|
+
put("/projects/#{url_encode project}/merge_requests/#{id}/rebase", body: options)
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to milestones.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/milestones.html
|
6
|
+
module Milestones
|
7
|
+
# Gets a list of project's milestones.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.milestones(5)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project The ID or name of a project.
|
13
|
+
# @param [Hash] options A customizable set of options.
|
14
|
+
# @option options [Integer] :page The page number.
|
15
|
+
# @option options [Integer] :per_page The number of results per page.
|
16
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
17
|
+
def milestones(project, options = {})
|
18
|
+
get("/projects/#{url_encode project}/milestones", query: options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Gets a single milestone.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# Gitlab.milestone(5, 36)
|
25
|
+
#
|
26
|
+
# @param [Integer, String] project The ID or name of a project.
|
27
|
+
# @param [Integer] id The ID of a milestone.
|
28
|
+
# @return [Gitlab::ObjectifiedHash]
|
29
|
+
def milestone(project, id)
|
30
|
+
get("/projects/#{url_encode project}/milestones/#{id}")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Gets the issues of a given milestone.
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Gitlab.milestone_issues(5, 2)
|
37
|
+
#
|
38
|
+
# @param [Integer, String] project The ID or name of a project.
|
39
|
+
# @param [Integer, String] milestone The ID of a milestone.
|
40
|
+
# @option options [Integer] :page The page number.
|
41
|
+
# @option options [Integer] :per_page The number of results per page.
|
42
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
43
|
+
def milestone_issues(project, milestone, options = {})
|
44
|
+
get("/projects/#{url_encode project}/milestones/#{milestone}/issues", query: options)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Gets the merge_requests of a given milestone.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# Gitlab.milestone_merge_requests(5, 2)
|
51
|
+
#
|
52
|
+
# @param [Integer, String] project The ID or name of a project.
|
53
|
+
# @param [Integer, String] milestone The ID of a milestone.
|
54
|
+
# @option options [Integer] :page The page number.
|
55
|
+
# @option options [Integer] :per_page The number of results per page.
|
56
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
57
|
+
def milestone_merge_requests(project, milestone, options = {})
|
58
|
+
get("/projects/#{url_encode project}/milestones/#{milestone}/merge_requests", query: options)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Creates a new milestone.
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
# Gitlab.create_milestone(5, 'v1.0')
|
65
|
+
#
|
66
|
+
# @param [Integer, String] project The ID or name of a project.
|
67
|
+
# @param [String] title The title of a milestone.
|
68
|
+
# @param [Hash] options A customizable set of options.
|
69
|
+
# @option options [String] :description The description of a milestone.
|
70
|
+
# @option options [String] :due_date The due date of a milestone.
|
71
|
+
# @return [Gitlab::ObjectifiedHash] Information about created milestone.
|
72
|
+
def create_milestone(project, title, options = {})
|
73
|
+
body = { title: title }.merge(options)
|
74
|
+
post("/projects/#{url_encode project}/milestones", body: body)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Updates a milestone.
|
78
|
+
#
|
79
|
+
# @example
|
80
|
+
# Gitlab.edit_milestone(5, 2, { state_event: 'activate' })
|
81
|
+
#
|
82
|
+
# @param [Integer, String] project The ID or name of a project.
|
83
|
+
# @param [Integer] id The ID of a milestone.
|
84
|
+
# @param [Hash] options A customizable set of options.
|
85
|
+
# @option options [String] :title The title of a milestone.
|
86
|
+
# @option options [String] :description The description of a milestone.
|
87
|
+
# @option options [String] :due_date The due date of a milestone.
|
88
|
+
# @option options [String] :state_event The state of a milestone ('close' or 'activate').
|
89
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated milestone.
|
90
|
+
def edit_milestone(project, id, options = {})
|
91
|
+
put("/projects/#{url_encode project}/milestones/#{id}", body: options)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Delete a project milestone.
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
# Gitlab.delete_milestone(5, 2)
|
98
|
+
#
|
99
|
+
# @param [Integer, String] project The ID or name of a project.
|
100
|
+
# @param [Integer] id The ID of a milestone.
|
101
|
+
# @return [nil] This API call returns an empty response body.
|
102
|
+
def delete_milestone(project, id)
|
103
|
+
delete("/projects/#{url_encode project}/milestones/#{id}")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to namespaces
|
5
|
+
# @see https://docs.gitlab.com/ce/api/namespaces.html
|
6
|
+
module Namespaces
|
7
|
+
# Gets a list of namespaces.
|
8
|
+
# @see https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# Gitlab.namespaces
|
12
|
+
#
|
13
|
+
# @param [Hash] options A customizable set of options.
|
14
|
+
# @options options [Integer] :page The page number.
|
15
|
+
# @options options [Integer] :per_page The number of results per page.
|
16
|
+
# @options opttion [String] :search The string to search for.
|
17
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
18
|
+
def namespaces(options = {})
|
19
|
+
get('/namespaces', query: options)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|