gitlab 4.2.0 → 4.18.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to feature flags.
|
5
|
+
# https://docs.gitlab.com/ce/api/features.html
|
6
|
+
module Features
|
7
|
+
# Get a list of all persisted features, with its gate values.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.features
|
11
|
+
#
|
12
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
13
|
+
def features
|
14
|
+
get('/features')
|
15
|
+
end
|
16
|
+
|
17
|
+
# Set a features gate value.
|
18
|
+
# If a feature with the given name does not exist yet it will be created. The value can be a boolean, or an integer to indicate percentage of time.
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# Gitlab.set_feature('new_library', true)
|
22
|
+
# Gitlab.set_feature('new_library', 8)
|
23
|
+
# Gitlab.set_feature('new_library', true, {user: 'gitlab'})
|
24
|
+
#
|
25
|
+
# @param [String] name(required) Name of the feature to create or update
|
26
|
+
# @param [String, Integer] value(required) true or false to enable/disable, or an integer for percentage of time
|
27
|
+
# @param [Hash] options A customizable set of options.
|
28
|
+
# @option options [String] :feature_group(optional) A Feature group name
|
29
|
+
# @option options [String] :user(optional) A GitLab username
|
30
|
+
# @option options [String] :project(optional) A projects path, for example "gitlab-org/gitlab-ce"
|
31
|
+
# @return [Gitlab::ObjectifiedHash] Information about the set/created/updated feature.
|
32
|
+
def set_feature(name, value, options = {})
|
33
|
+
body = { value: value }.merge(options)
|
34
|
+
post("/features/#{name}", body: body)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Delete a feature.
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Gitlab.delete_feature('new_library')
|
41
|
+
#
|
42
|
+
# @param [String] name Name of the feature to delete
|
43
|
+
# @return [void] This API call returns an empty response body.
|
44
|
+
def delete_feature(name)
|
45
|
+
delete("/features/#{name}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to group badges.
|
5
|
+
# @see https://docs.gitlab.com/ee/api/group_badges.html
|
6
|
+
module GroupBadges
|
7
|
+
# Gets a list of a groups badges.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.group_badges(5)
|
11
|
+
# Gitlab.group_badges(5, 'Coverage')
|
12
|
+
#
|
13
|
+
# @param [Integer, String] group(required) The ID or URL-encoded path of the group owned by the authenticated user.
|
14
|
+
# @param [String] name(optional) Name of the badges to return (case-sensitive).
|
15
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of all badges of a group
|
16
|
+
def group_badges(group, name = nil)
|
17
|
+
query = { name: name } if name
|
18
|
+
get("/groups/#{url_encode group}/badges", query: query)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Gets a badge of a group.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# Gitlab.group_badge(5, 42)
|
25
|
+
#
|
26
|
+
# @param [Integer, String] group(required) The ID or URL-encoded path of the group owned by the authenticated user.
|
27
|
+
# @param [Integer] badge_id(required) The badge ID.
|
28
|
+
# @return [Gitlab::ObjectifiedHash] Information about the requested badge
|
29
|
+
def group_badge(group, badge_id)
|
30
|
+
get("/groups/#{url_encode group}/badges/#{badge_id}")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Adds a badge to a group.
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Gitlab.add_group_badge(5, { link_url: 'https://abc.com/gitlab/gitlab-ce/commits/master', image_url: 'https://shields.io/my/badge1' })
|
37
|
+
#
|
38
|
+
# @param [Integer, String] group(required) The ID or URL-encoded path of the group owned by the authenticated user.
|
39
|
+
# @param [Hash] options A customizable set of options.
|
40
|
+
# @option options [String] :link_url(required) URL of the badge link
|
41
|
+
# @option options [String] :image_url(required) URL of the badge image
|
42
|
+
# @return [Gitlab::ObjectifiedHash] Information about the added group badge.
|
43
|
+
def add_group_badge(group, options = {})
|
44
|
+
post("/groups/#{url_encode group}/badges", body: options)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Updates a badge of a group.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# Gitlab.edit_group_badge(5, 1, { link_url: 'https://abc.com/gitlab/gitlab-ce/commits/master', image_url: 'https://shields.io/my/badge1' })
|
51
|
+
#
|
52
|
+
# @param [Integer, String] group(required) The ID or URL-encoded path of the group owned by the authenticated user.
|
53
|
+
# @param [Integer] badge_id(required) The badge ID.
|
54
|
+
# @param [Hash] options A customizable set of options.
|
55
|
+
# @option options [String] :link_url(optional) URL of the badge link
|
56
|
+
# @option options [String] :image_url(optional) URL of the badge image
|
57
|
+
# @return [Gitlab::ObjectifiedHash] Information about the updated group badge.
|
58
|
+
def edit_group_badge(group, badge_id, options = {})
|
59
|
+
put("/groups/#{url_encode group}/badges/#{badge_id}", body: options)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Removes a badge from a group.
|
63
|
+
#
|
64
|
+
# @example
|
65
|
+
# Gitlab.remove_group_badge(5, 42)
|
66
|
+
#
|
67
|
+
# @param [Integer, String] group(required) The ID or URL-encoded path of the group owned by the authenticated user.
|
68
|
+
# @param [Integer] badge_id(required) The badge ID.
|
69
|
+
# @return [nil] This API call returns an empty response body.
|
70
|
+
def remove_group_badge(group, badge_id)
|
71
|
+
delete("/groups/#{url_encode group}/badges/#{badge_id}")
|
72
|
+
end
|
73
|
+
|
74
|
+
# Preview a badge from a group.
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# Gitlab.preview_group_badge(3, 'https://abc.com/gitlab/gitlab-ce/commits/master', 'https://shields.io/my/badge1')
|
78
|
+
#
|
79
|
+
# @param [Integer, String] group(required) The ID or URL-encoded path of the group owned by the authenticated user.
|
80
|
+
# @param [String] :link_url(required) URL of the badge link
|
81
|
+
# @param [String] :image_url(required) URL of the badge image
|
82
|
+
# @return [Gitlab::ObjectifiedHash] Returns how the link_url and image_url final URLs would be after resolving the placeholder interpolation.
|
83
|
+
def preview_group_badge(group, link_url, image_url)
|
84
|
+
query = { link_url: link_url, image_url: image_url }
|
85
|
+
get("/groups/#{url_encode group}/badges/render", query: query)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to group issue boards.
|
5
|
+
# @see https://docs.gitlab.com/ee/api/group_boards.html
|
6
|
+
module GroupBoards
|
7
|
+
# Lists Issue Boards in the given group.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.group_boards(5)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] group The ID or name of a group.
|
13
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of issue boards of the group
|
14
|
+
def group_boards(group)
|
15
|
+
get("/groups/#{url_encode group}/boards")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gets a single group issue board.
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# Gitlab.group_board(5, 1)
|
22
|
+
#
|
23
|
+
# @param [Integer, String] group The ID or name of a group.
|
24
|
+
# @param [Integer] id The ID of the issue board.
|
25
|
+
# @return [Gitlab::ObjectifiedHash] Returns information about a group issue board
|
26
|
+
def group_board(group, id)
|
27
|
+
get("/groups/#{url_encode group}/boards/#{id}")
|
28
|
+
end
|
29
|
+
|
30
|
+
# Creates a new group issue board.
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# Gitlab.create_group_board(5, 'Documentcloud')
|
34
|
+
#
|
35
|
+
# @param [Integer, String] group The ID or name of a group.
|
36
|
+
# @param [String] name The name of the new board.
|
37
|
+
# @return [Gitlab::ObjectifiedHash] Information about created group issue board.
|
38
|
+
def create_group_board(group, name)
|
39
|
+
body = { name: name }
|
40
|
+
post("/groups/#{url_encode group}/boards", body: body)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Updates a group issue board.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# Gitlab.edit_group_board(5, 1, { name: 'DocumentCloud2' })
|
47
|
+
# Gitlab.edit_group_board(5, 1, { name: 'DocumentCloud2', assignee_id: 3 })
|
48
|
+
#
|
49
|
+
# @param [Integer, String] group The ID or name of a group.
|
50
|
+
# @param [Integer] id The ID of the issue board.
|
51
|
+
# @param [Hash] options A customizable set of options.
|
52
|
+
# @option options [String] :name(optional) The new name of the board.
|
53
|
+
# @option options [Integer] :assignee_id(optional) The assignee the board should be scoped to.
|
54
|
+
# @option options [Integer] :milestone_id(optional) The milestone the board should be scoped to.
|
55
|
+
# @option options [String] :labels(optional) Comma-separated list of label names which the board should be scoped to.
|
56
|
+
# @option options [Integer] :weight(optional) The weight range from 0 to 9, to which the board should be scoped to.
|
57
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated group issue board.
|
58
|
+
def edit_group_board(group, id, options = {})
|
59
|
+
put("/groups/#{url_encode group}/boards/#{id}", body: options)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Deletes a group issue board.
|
63
|
+
#
|
64
|
+
# @example
|
65
|
+
# Gitlab.delete_group_board(5, 1)
|
66
|
+
#
|
67
|
+
# @param [Integer, String] group The ID or name of a group.
|
68
|
+
# @param [Integer] id The ID of the issue board.
|
69
|
+
# @return [void] This API call returns an empty response body.
|
70
|
+
def delete_group_board(group, id)
|
71
|
+
delete("/groups/#{url_encode group}/boards/#{id}")
|
72
|
+
end
|
73
|
+
|
74
|
+
# Get a list of the boards lists. Does not include open and closed lists
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# Gitlab.group_board_lists(5, 1)
|
78
|
+
#
|
79
|
+
# @param [Integer, String] group The ID or name of a group.
|
80
|
+
# @param [Integer] board_id The ID of the group issue board.
|
81
|
+
# @return [Array<Gitlab::ObjectifiedHash>] List of boards lists of the group
|
82
|
+
def group_board_lists(group, board_id)
|
83
|
+
get("/groups/#{url_encode group}/boards/#{board_id}/lists")
|
84
|
+
end
|
85
|
+
|
86
|
+
# Get a single group issue board list.
|
87
|
+
#
|
88
|
+
# @example
|
89
|
+
# Gitlab.group_board_list(5, 1, 1)
|
90
|
+
#
|
91
|
+
# @param [Integer, String] group The ID or name of a group.
|
92
|
+
# @param [Integer] board_id The ID of the group issue board.
|
93
|
+
# @param [Integer] list_id The ID of a boards list.
|
94
|
+
# @return [Gitlab::ObjectifiedHash] Returns information about a single group issue board list
|
95
|
+
def group_board_list(group, board_id, id)
|
96
|
+
get("/groups/#{url_encode group}/boards/#{board_id}/lists/#{id}")
|
97
|
+
end
|
98
|
+
|
99
|
+
# Creates a new group issue board list.
|
100
|
+
#
|
101
|
+
# @example
|
102
|
+
# Gitlab.create_group_board_list(5, 1)
|
103
|
+
#
|
104
|
+
# @param [Integer, String] group The ID or name of a group.
|
105
|
+
# @param [Integer] board_id The ID of the group issue board.
|
106
|
+
# @param [Integer] label_id The ID of a label.
|
107
|
+
# @return [Gitlab::ObjectifiedHash] Information about created group issue board list.
|
108
|
+
def create_group_board_list(group, board_id, label_id)
|
109
|
+
body = { label_id: label_id }
|
110
|
+
post("/groups/#{url_encode group}/boards/#{board_id}/lists", body: body)
|
111
|
+
end
|
112
|
+
|
113
|
+
# Updates an existing group issue board list. This call is used to change list position.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
# Gitlab.edit_group_board_list(5, 1, 1, { position: 1 })
|
117
|
+
#
|
118
|
+
# @param [Integer, String] group The ID or name of a group.
|
119
|
+
# @param [Integer] board_id The ID of the group issue board.
|
120
|
+
# @param [Integer] list_id The ID of a boards list.
|
121
|
+
# @param [Hash] options A customizable set of options.
|
122
|
+
# @option options [String] :position(required) The position of the list.
|
123
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated group issue board list.
|
124
|
+
def edit_group_board_list(group, board_id, id, options = {})
|
125
|
+
put("/groups/#{url_encode group}/boards/#{board_id}/lists/#{id}", body: options)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Deletes a group issue board list.
|
129
|
+
#
|
130
|
+
# @example
|
131
|
+
# Gitlab.delete_group_board_list(5, 1, 1)
|
132
|
+
#
|
133
|
+
# @param [Integer, String] group The ID or name of a group.
|
134
|
+
# @param [Integer] board_id The ID of the group issue board.
|
135
|
+
# @param [Integer] list_id The ID of a boards list.
|
136
|
+
# @return [void] This API call returns an empty response body.
|
137
|
+
def delete_group_board_list(group, board_id, id)
|
138
|
+
delete("/groups/#{url_encode group}/boards/#{board_id}/lists/#{id}")
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to group labels.
|
5
|
+
#
|
6
|
+
# @note Requires GitLab 11.8+
|
7
|
+
# @see https://docs.gitlab.com/ee/api/group_labels.html
|
8
|
+
module GroupLabels
|
9
|
+
# Gets a list of group's labels.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Gitlab.group_labels('globex')
|
13
|
+
#
|
14
|
+
# @param [Integer, String] group The ID or name of a group.
|
15
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
16
|
+
def group_labels(group, options = {})
|
17
|
+
get("/groups/#{url_encode group}/labels", query: options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Creates a new group label.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# Gitlab.create_group_label('globex', 'Backlog', '#DD10AA')
|
24
|
+
#
|
25
|
+
# @param [Integer, String] group The ID or name of a group.
|
26
|
+
# @param [String] name The name of a label.
|
27
|
+
# @param [String] color The color of a label.
|
28
|
+
# @param [Hash] options A customizable set of options.
|
29
|
+
# @option options [String] :description The description of the label.
|
30
|
+
# @return [Gitlab::ObjectifiedHash] Information about created label.
|
31
|
+
def create_group_label(group, name, color, options = {})
|
32
|
+
post("/groups/#{url_encode group}/labels", body: options.merge(name: name, color: color))
|
33
|
+
end
|
34
|
+
|
35
|
+
# Updates a group label.
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# Gitlab.edit_group_label('globex', 'Backlog', { new_name: 'Priority' })
|
39
|
+
# Gitlab.edit_group_label('globex', 'Backlog', { new_name: 'Priority', color: '#DD10AA' })
|
40
|
+
#
|
41
|
+
# @param [Integer, String] group The ID or name of a group.
|
42
|
+
# @param [String] name The name of a label.
|
43
|
+
# @param [Hash] options A customizable set of options.
|
44
|
+
# @option options [String] :new_name The new name of a label.
|
45
|
+
# @option options [String] :color The color of a label.
|
46
|
+
# @option options [String] :description The description of the label.
|
47
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated label.
|
48
|
+
def edit_group_label(group, name, options = {})
|
49
|
+
put("/groups/#{url_encode group}/labels", body: options.merge(name: name))
|
50
|
+
end
|
51
|
+
|
52
|
+
# Deletes a group label.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# Gitlab.delete_group_label('globex', 'Backlog')
|
56
|
+
#
|
57
|
+
# @param [Integer, String] group The ID or name of a group.
|
58
|
+
# @param [String] name The name of a label.
|
59
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted label.
|
60
|
+
def delete_group_label(group, name)
|
61
|
+
delete("/groups/#{url_encode group}/labels/#{name}")
|
62
|
+
end
|
63
|
+
|
64
|
+
# Subscribes the user to a group label to receive notifications
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# Gitlab.subscribe_to_group_label('globex', 'Backlog')
|
68
|
+
#
|
69
|
+
# @param [Integer, String] group The ID or name of a group.
|
70
|
+
# @param [String] name The name of a label.
|
71
|
+
# @return [Gitlab::ObjectifiedHash] Information about the label subscribed to.
|
72
|
+
def subscribe_to_group_label(group, name)
|
73
|
+
post("/groups/#{url_encode group}/labels/#{url_encode name}/subscribe")
|
74
|
+
end
|
75
|
+
|
76
|
+
# Unsubscribes the user from a group label to not receive notifications from it
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# Gitlab.unsubscribe_from_group_label('globex', 'Backlog')
|
80
|
+
#
|
81
|
+
# @param [Integer, String] group The ID or name of a group.
|
82
|
+
# @param [String] name The name of a label.
|
83
|
+
# @return [Gitlab::ObjectifiedHash] Information about the label unsubscribed from.
|
84
|
+
def unsubscribe_from_group_label(group, name)
|
85
|
+
post("/groups/#{url_encode group}/labels/#{url_encode name}/unsubscribe")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to group milestones.
|
5
|
+
# @see https://docs.gitlab.com/ee/api/group_milestones.html
|
6
|
+
module GroupMilestones
|
7
|
+
# Gets a list of a group's milestones.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.group_milestones(5)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] id The ID or name of a group.
|
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 group_milestones(id, options = {})
|
18
|
+
get("/groups/#{url_encode id}/milestones", query: options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Gets a single group milestone.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# Gitlab.group_milestone(5, 36)
|
25
|
+
#
|
26
|
+
# @param [Integer, String] id The ID or name of a group.
|
27
|
+
# @param [Integer] milestone_id The ID of a milestone.
|
28
|
+
# @return [Gitlab::ObjectifiedHash]
|
29
|
+
def group_milestone(id, milestone_id)
|
30
|
+
get("/groups/#{url_encode id}/milestones/#{milestone_id}")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Creates a new group milestone.
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# Gitlab.create_group_milestone(5, 'v1.0')
|
37
|
+
#
|
38
|
+
# @param [Integer, String] id The ID or name of a group.
|
39
|
+
# @param [String] title The title of a milestone.
|
40
|
+
# @param [Hash] options A customizable set of options.
|
41
|
+
# @option options [String] :description The description of a milestone.
|
42
|
+
# @option options [String] :due_date The due date of a milestone.
|
43
|
+
# @return [Gitlab::ObjectifiedHash] Information about created milestone.
|
44
|
+
def create_group_milestone(id, title, options = {})
|
45
|
+
body = { title: title }.merge(options)
|
46
|
+
post("/groups/#{url_encode id}/milestones", body: body)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Updates a group milestone.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# Gitlab.edit_group_milestone(5, 2, { state_event: 'activate' })
|
53
|
+
#
|
54
|
+
# @param [Integer, String] id The ID or name of a group.
|
55
|
+
# @param [Integer] milestone_id The ID of a milestone.
|
56
|
+
# @param [Hash] options A customizable set of options.
|
57
|
+
# @option options [String] :title The title of a milestone.
|
58
|
+
# @option options [String] :description The description of a milestone.
|
59
|
+
# @option options [String] :due_date The due date of a milestone.
|
60
|
+
# @option options [String] :state_event The state of a milestone ('close' or 'activate').
|
61
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated milestone.
|
62
|
+
def edit_group_milestone(id, milestone_id, options = {})
|
63
|
+
put("/groups/#{url_encode id}/milestones/#{milestone_id}", body: options)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Gets the issues of a given group milestone.
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# Gitlab.group_milestone_issues(5, 2)
|
70
|
+
#
|
71
|
+
# @param [Integer, String] id The ID or name of a group.
|
72
|
+
# @param [Integer, String] milestone_id The ID of a milestone.
|
73
|
+
# @option options [Integer] :page The page number.
|
74
|
+
# @option options [Integer] :per_page The number of results per page.
|
75
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
76
|
+
def group_milestone_issues(id, milestone_id, options = {})
|
77
|
+
get("/groups/#{url_encode id}/milestones/#{milestone_id}/issues", query: options)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Gets the merge_requests of a given group milestone.
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# Gitlab.group_milestone_merge_requests(5, 2)
|
84
|
+
#
|
85
|
+
# @param [Integer, String] group The ID or name of a group.
|
86
|
+
# @param [Integer, String] milestone_id The ID of a milestone.
|
87
|
+
# @option options [Integer] :page The page number.
|
88
|
+
# @option options [Integer] :per_page The number of results per page.
|
89
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
90
|
+
def group_milestone_merge_requests(id, milestone_id, options = {})
|
91
|
+
get("/groups/#{url_encode id}/milestones/#{milestone_id}/merge_requests", query: options)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|