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
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Gitlab::Client
|
2
4
|
# Defines methods related to repositories.
|
3
5
|
# @see https://docs.gitlab.com/ce/api/repositories.html
|
@@ -11,12 +13,13 @@ class Gitlab::Client
|
|
11
13
|
# @param [Integer, String] project The ID or name of a project.
|
12
14
|
# @param [Hash] options A customizable set of options.
|
13
15
|
# @option options [String] :path The path inside repository.
|
14
|
-
# @option options [String] :
|
16
|
+
# @option options [String] :ref The name of a repository branch or tag.
|
17
|
+
# @option options [Integer] :per_page Number of results to show per page (default = 20)
|
15
18
|
# @return [Gitlab::ObjectifiedHash]
|
16
|
-
def tree(project, options={})
|
19
|
+
def tree(project, options = {})
|
17
20
|
get("/projects/#{url_encode project}/repository/tree", query: options)
|
18
21
|
end
|
19
|
-
|
22
|
+
alias repo_tree tree
|
20
23
|
|
21
24
|
# Get project repository archive
|
22
25
|
#
|
@@ -26,9 +29,10 @@ class Gitlab::Client
|
|
26
29
|
#
|
27
30
|
# @param [Integer, String] project The ID or name of a project.
|
28
31
|
# @param [String] ref The commit sha, branch, or tag to download.
|
32
|
+
# @param [String] format The archive format. Options are: tar.gz (default), tar.bz2, tbz, tbz2, tb2, bz2, tar, and zip
|
29
33
|
# @return [Gitlab::FileResponse]
|
30
|
-
def repo_archive(project, ref = 'master')
|
31
|
-
get("/projects/#{url_encode project}/repository/archive",
|
34
|
+
def repo_archive(project, ref = 'master', format = 'tar.gz')
|
35
|
+
get("/projects/#{url_encode project}/repository/archive.#{format}",
|
32
36
|
format: nil,
|
33
37
|
headers: { Accept: 'application/octet-stream' },
|
34
38
|
query: { sha: ref },
|
@@ -54,6 +58,56 @@ class Gitlab::Client
|
|
54
58
|
def compare(project, from, to)
|
55
59
|
get("/projects/#{url_encode project}/repository/compare", query: { from: from, to: to })
|
56
60
|
end
|
57
|
-
|
61
|
+
alias repo_compare compare
|
62
|
+
|
63
|
+
# Get the common ancestor for 2 refs (commit SHAs, branch names or tags).
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# Gitlab.merge_base(42, ['master', 'feature/branch'])
|
67
|
+
# Gitlab.merge_base(42, ['master', 'feature/branch'])
|
68
|
+
#
|
69
|
+
# @param [Integer, String] project The ID or URL-encoded path of the project.
|
70
|
+
# @param [Array] refs Array containing 2 commit SHAs, branch names, or tags.
|
71
|
+
# @return [Gitlab::ObjectifiedHash]
|
72
|
+
def merge_base(project, refs)
|
73
|
+
get("/projects/#{url_encode project}/repository/merge_base", query: { refs: refs })
|
74
|
+
end
|
75
|
+
|
76
|
+
# Get project repository contributors.
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# Gitlab.contributors(42)
|
80
|
+
# Gitlab.contributors(42, { order: 'name' })
|
81
|
+
#
|
82
|
+
# @param [Integer, String] project The ID or name of a project.
|
83
|
+
# @param [Hash] options A customizable set of options.
|
84
|
+
# @option options [String] :order_by Order by name, email or commits (default = commits).
|
85
|
+
# @option options [String] :sort Sort order asc or desc (default = asc).
|
86
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
87
|
+
def contributors(project, options = {})
|
88
|
+
get("/projects/#{url_encode project}/repository/contributors", query: options)
|
89
|
+
end
|
90
|
+
alias repo_contributors contributors
|
91
|
+
|
92
|
+
# Generate changelog data
|
93
|
+
#
|
94
|
+
# @example
|
95
|
+
# Gitlab.generate_changelog(42, 'v1.0.0')
|
96
|
+
# Gitlab.generate_changelog(42, 'v1.0.0', branch: 'main')
|
97
|
+
#
|
98
|
+
# @param [Integer, String] project The ID or name of a project
|
99
|
+
# @param [String] version The version to generate the changelog for
|
100
|
+
# @param [Hash] options A customizable set of options
|
101
|
+
# @option options [String] :from The start of the range of commits (SHA)
|
102
|
+
# @option options [String] :to The end of the range of commits (as a SHA) to use for the changelog
|
103
|
+
# @option options [String] :date The date and time of the release, defaults to the current time
|
104
|
+
# @option options [String] :branch The branch to commit the changelog changes to
|
105
|
+
# @option options [String] :trailer The Git trailer to use for including commits
|
106
|
+
# @option options [String] :file The file to commit the changes to
|
107
|
+
# @option options [String] :message The commit message to produce when committing the changes
|
108
|
+
# @return [bool]
|
109
|
+
def generate_changelog(project, version, options = {})
|
110
|
+
post("/projects/#{url_encode project}/repository/changelog", body: options.merge(version: version))
|
111
|
+
end
|
58
112
|
end
|
59
113
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'base64'
|
2
4
|
|
3
5
|
class Gitlab::Client
|
@@ -14,15 +16,30 @@ class Gitlab::Client
|
|
14
16
|
# @param [String] filepath The relative path of the file in the repository
|
15
17
|
# @param [String] ref The name of a repository branch or tag or if not given the default branch.
|
16
18
|
# @return [String]
|
17
|
-
def file_contents(project, filepath, ref='master')
|
18
|
-
ref = URI.encode(ref, /\W/)
|
19
|
+
def file_contents(project, filepath, ref = 'master')
|
19
20
|
get "/projects/#{url_encode project}/repository/files/#{url_encode filepath}/raw",
|
20
|
-
query: { ref: ref},
|
21
|
+
query: { ref: ref },
|
21
22
|
format: nil,
|
22
23
|
headers: { Accept: 'text/plain' },
|
23
24
|
parser: ::Gitlab::Request::Parser
|
24
25
|
end
|
25
|
-
|
26
|
+
alias repo_file_contents file_contents
|
27
|
+
|
28
|
+
# Get file blame from repository
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# Gitlab.get_file_blame(42, "README.md", "master")
|
32
|
+
#
|
33
|
+
# @param [Integer, String] project The ID or name of a project.
|
34
|
+
# @param [String] file_path The full path of the file.
|
35
|
+
# @param [String] ref The name of branch, tag or commit.
|
36
|
+
# @return [Gitlab::ObjectifiedHash]
|
37
|
+
#
|
38
|
+
def get_file_blame(project, file_path, ref)
|
39
|
+
get("/projects/#{url_encode project}/repository/files/#{url_encode file_path}/blame", query: {
|
40
|
+
ref: ref
|
41
|
+
})
|
42
|
+
end
|
26
43
|
|
27
44
|
# Gets a repository file.
|
28
45
|
#
|
@@ -95,7 +112,8 @@ class Gitlab::Client
|
|
95
112
|
# @option options [String] :author_email Commit author's email address
|
96
113
|
# @return [Gitlab::ObjectifiedHash]
|
97
114
|
def remove_file(project, path, branch, commit_message, options = {})
|
98
|
-
delete("/projects/#{url_encode project}/repository/files/#{url_encode path}",
|
115
|
+
delete("/projects/#{url_encode project}/repository/files/#{url_encode path}",
|
116
|
+
body: {
|
99
117
|
branch: branch,
|
100
118
|
commit_message: commit_message
|
101
119
|
}.merge(options))
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to repository submodules.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/repository_submodules.html
|
6
|
+
module RepositorySubmodules
|
7
|
+
# Edits an existing repository submodule.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.edit_file(42, "submodule", {
|
11
|
+
# branch: "branch",
|
12
|
+
# commit_sha: "3ddec28ea23acc5caa5d8331a6ecb2a65fc03e88",
|
13
|
+
# commit_message: "commit message"
|
14
|
+
# })
|
15
|
+
#
|
16
|
+
# @param [Integer, String] project The ID or name of a project.
|
17
|
+
# @param [String] submodule full path of submodule to update.
|
18
|
+
# @param [Hash] options A customizable set of options.
|
19
|
+
# @param options [String] :branch the name of the branch to commit changes to.
|
20
|
+
# @param options [String] :commit_sha commit SHA to update the submodule to.
|
21
|
+
# @param options [String] :commit_message commit message text.
|
22
|
+
# @return [Gitlab::ObjectifiedHash]
|
23
|
+
def edit_submodule(project, submodule, options = {})
|
24
|
+
put("/projects/#{url_encode project}/repository/submodules/#{url_encode submodule}", body: options)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to resource label events.
|
5
|
+
# @see https://docs.gitlab.com/ee/api/resource_label_events.html
|
6
|
+
module ResourceLabelEvents
|
7
|
+
# Gets a list of all label events for a single issue.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.issue_label_events(5, 42)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project The ID or name of a project.
|
13
|
+
# @param [Integer] issue_iid The IID of an issue.
|
14
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
|
+
def issue_label_events(project, issue_iid)
|
16
|
+
get("/projects/#{url_encode project}/issues/#{issue_iid}/resource_label_events")
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns a single label event for a specific project issue
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# Gitlab.issue_label_event(5, 42, 1)
|
23
|
+
#
|
24
|
+
# @param [Integer, String] project The ID or name of a project.
|
25
|
+
# @param [Integer] issue_iid The IID of an issue.
|
26
|
+
# @param [Integer] id The ID of a label event.
|
27
|
+
# @return Gitlab::ObjectifiedHash
|
28
|
+
def issue_label_event(project, issue_iid, id)
|
29
|
+
get("/projects/#{url_encode project}/issues/#{issue_iid}/resource_label_events/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# Gets a list of all label events for a single epic.
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# Gitlab.epic_label_events(5, 42)
|
36
|
+
#
|
37
|
+
# @param [Integer, String] group The ID or name of a group.
|
38
|
+
# @param [Integer] epic_id The ID of an epic.
|
39
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
40
|
+
def epic_label_events(group, epic_id)
|
41
|
+
get("/groups/#{url_encode group}/epics/#{epic_id}/resource_label_events")
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns a single label event for a specific group epic
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# Gitlab.epic_label_event(5, 42, 1)
|
48
|
+
#
|
49
|
+
# @param [Integer, String] group The ID or name of a group.
|
50
|
+
# @param [Integer] epic_id The ID of an epic.
|
51
|
+
# @param [Integer] id The ID of a label event.
|
52
|
+
# @return Gitlab::ObjectifiedHash
|
53
|
+
def epic_label_event(group, epic_id, id)
|
54
|
+
get("/groups/#{url_encode group}/epics/#{epic_id}/resource_label_events/#{id}")
|
55
|
+
end
|
56
|
+
|
57
|
+
# Gets a list of all label events for a single merge request.
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# Gitlab.merge_request_label_events(5, 42)
|
61
|
+
#
|
62
|
+
# @param [Integer, String] project The ID or name of a project.
|
63
|
+
# @param [Integer] merge_request_iid The IID of a merge request.
|
64
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
65
|
+
def merge_request_label_events(project, merge_request_iid)
|
66
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_iid}/resource_label_events")
|
67
|
+
end
|
68
|
+
|
69
|
+
# Returns a single label event for a specific project merge request
|
70
|
+
#
|
71
|
+
# @example
|
72
|
+
# Gitlab.merge_request_label_event(5, 42, 1)
|
73
|
+
#
|
74
|
+
# @param [Integer, String] project The ID or name of a project.
|
75
|
+
# @param [Integer] merge_request_iid The IID of an merge request.
|
76
|
+
# @param [Integer] id The ID of a label event.
|
77
|
+
# @return Gitlab::ObjectifiedHash
|
78
|
+
def merge_request_label_event(project, merge_request_iid, id)
|
79
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_iid}/resource_label_events/#{id}")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to resource state events.
|
5
|
+
# @see https://docs.gitlab.com/ee/api/resource_state_events.html
|
6
|
+
module ResourceStateEvents
|
7
|
+
# Gets a list of all state events for a single issue.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.issue_state_events(5, 42)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project The ID or name of a project.
|
13
|
+
# @param [Integer] issue_iid The IID of an issue.
|
14
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
15
|
+
def issue_state_events(project, issue_iid)
|
16
|
+
get("/projects/#{url_encode project}/issues/#{issue_iid}/resource_state_events")
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns a single state event for a specific project issue
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# Gitlab.issue_state_event(5, 42, 1)
|
23
|
+
#
|
24
|
+
# @param [Integer, String] project The ID or name of a project.
|
25
|
+
# @param [Integer] issue_iid The IID of an issue.
|
26
|
+
# @param [Integer] id The ID of a resource event.
|
27
|
+
# @return Gitlab::ObjectifiedHash
|
28
|
+
def issue_state_event(project, issue_iid, id)
|
29
|
+
get("/projects/#{url_encode project}/issues/#{issue_iid}/resource_state_events/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# Gets a list of all state events for a single merge request.
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# Gitlab.merge_request_state_events(5, 42)
|
36
|
+
#
|
37
|
+
# @param [Integer, String] project The ID or name of a project.
|
38
|
+
# @param [Integer] merge_request_iid The IID of a merge request.
|
39
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
40
|
+
def merge_request_state_events(project, merge_request_iid)
|
41
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_iid}/resource_state_events")
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns a single state event for a specific project merge request
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# Gitlab.merge_request_state_event(5, 42, 1)
|
48
|
+
#
|
49
|
+
# @param [Integer, String] project The ID or name of a project.
|
50
|
+
# @param [Integer] merge_request_iid The IID of an merge request.
|
51
|
+
# @param [Integer] id The ID of a state event.
|
52
|
+
# @return Gitlab::ObjectifiedHash
|
53
|
+
def merge_request_state_event(project, merge_request_iid, id)
|
54
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_iid}/resource_state_events/#{id}")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -1,21 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Gitlab::Client
|
2
4
|
# Defines methods related to runners.
|
3
5
|
# @see https://docs.gitlab.com/ce/api/runners.html
|
4
6
|
module Runners
|
5
|
-
|
6
7
|
# Get a list of specific runners available to the user.
|
7
8
|
# @see https://docs.gitlab.com/ce/api/runners.html#list-owned-runners
|
8
9
|
#
|
9
10
|
# @example
|
10
11
|
# Gitlab.runners
|
11
|
-
# Gitlab.runners(:active)
|
12
|
-
# Gitlab.runners(:
|
12
|
+
# Gitlab.runners(type: 'instance_type', status: 'active')
|
13
|
+
# Gitlab.runners(tag_list: 'tag1,tag2')
|
13
14
|
#
|
14
15
|
# @param [Hash] options A customizable set of options.
|
15
|
-
# @option options [String] :
|
16
|
+
# @option options [String] :type(optional) The type of runners to show, one of: instance_type, group_type, project_type
|
17
|
+
# @option options [String] :status(optional) The status of runners to show, one of: active, paused, online, offline
|
18
|
+
# @option options [String] :tag_list(optional) List of the runners tags (separated by comma)
|
16
19
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
17
20
|
def runners(options = {})
|
18
|
-
get(
|
21
|
+
get('/runners', query: options)
|
19
22
|
end
|
20
23
|
|
21
24
|
# Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges.
|
@@ -23,12 +26,16 @@ class Gitlab::Client
|
|
23
26
|
#
|
24
27
|
# @example
|
25
28
|
# Gitlab.all_runners
|
29
|
+
# Gitlab.all_runners(type: 'instance_type', status: 'active')
|
30
|
+
# Gitlab.all_runners(tag_list: 'tag1,tag2')
|
26
31
|
#
|
27
32
|
# @param [Hash] options A customizable set of options.
|
28
|
-
# @option options [String] :
|
33
|
+
# @option options [String] :type(optional) The type of runners to show, one of: instance_type, group_type, project_type
|
34
|
+
# @option options [String] :status(optional) The status of runners to show, one of: active, paused, online, offline
|
35
|
+
# @option options [String] :tag_list(optional) List of the runners tags (separated by comma)
|
29
36
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
30
37
|
def all_runners(options = {})
|
31
|
-
get(
|
38
|
+
get('/runners/all', query: options)
|
32
39
|
end
|
33
40
|
|
34
41
|
# Get details of a runner..
|
@@ -49,15 +56,19 @@ class Gitlab::Client
|
|
49
56
|
# @example
|
50
57
|
# Gitlab.update_runner(42, { description: 'Awesome runner' })
|
51
58
|
# Gitlab.update_runner(42, { active: false })
|
52
|
-
# Gitlab.update_runner(42, { tag_list: [ 'awesome', 'runner' ] })
|
53
59
|
#
|
54
60
|
# @param [Integer, String] id The ID of a runner
|
55
61
|
# @param [Hash] options A customizable set of options.
|
56
|
-
# @option options [String] :
|
57
|
-
# @option options [
|
62
|
+
# @option options [String] :description(optional) The description of a runner
|
63
|
+
# @option options [Boolean] :active(optional) The state of a runner; can be set to true or false
|
64
|
+
# @option options [String] :tag_list(optional) The list of tags for a runner; put array of tags, that should be finally assigned to a runner(separated by comma)
|
65
|
+
# @option options [Boolean] :run_untagged(optional) Flag indicating the runner can execute untagged jobs
|
66
|
+
# @option options [Boolean] :locked(optional) Flag indicating the runner is locked
|
67
|
+
# @option options [String] :access_level(optional) The access_level of the runner; not_protected or ref_protected
|
68
|
+
# @option options [Integer] :maximum_timeout(optional) Maximum timeout set when this runner will handle the job
|
58
69
|
# @return <Gitlab::ObjectifiedHash>
|
59
|
-
def update_runner(id, options={})
|
60
|
-
put("/runners/#{id}",
|
70
|
+
def update_runner(id, options = {})
|
71
|
+
put("/runners/#{id}", body: options)
|
61
72
|
end
|
62
73
|
|
63
74
|
# Remove a runner.
|
@@ -67,21 +78,44 @@ class Gitlab::Client
|
|
67
78
|
# Gitlab.delete_runner(42)
|
68
79
|
#
|
69
80
|
# @param [Integer, String] id The ID of a runner
|
70
|
-
# @return
|
81
|
+
# @return [nil] This API call returns an empty response body.
|
71
82
|
def delete_runner(id)
|
72
83
|
delete("/runners/#{id}")
|
73
84
|
end
|
74
85
|
|
86
|
+
# List jobs that are being processed or were processed by specified runner.
|
87
|
+
#
|
88
|
+
# @example
|
89
|
+
# Gitlab.runner_jobs(1)
|
90
|
+
# Gitlab.runner_jobs(1, status: 'success')
|
91
|
+
# Gitlab.runner_jobs(1, sort: 'desc')
|
92
|
+
#
|
93
|
+
# @param [Integer] id The ID of a runner.
|
94
|
+
# @param [Hash] options A customizable set of options.
|
95
|
+
# @option options [String] :status(optional) Status of the job; one of: running, success, failed, canceled
|
96
|
+
# @option options [String] :order_by(optional) Order jobs by id.
|
97
|
+
# @option options [String] :sort(optional) Sort jobs in asc or desc order (default: desc)
|
98
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
99
|
+
def runner_jobs(runner_id, options = {})
|
100
|
+
get("/runners/#{url_encode runner_id}/jobs", query: options)
|
101
|
+
end
|
102
|
+
|
75
103
|
# List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings.
|
76
104
|
# @see https://docs.gitlab.com/ce/api/runners.html#list-projects-runners
|
77
105
|
#
|
78
106
|
# @example
|
79
107
|
# Gitlab.project_runners(42)
|
108
|
+
# Gitlab.project_runners(42, type: 'instance_type', status: 'active')
|
109
|
+
# Gitlab.project_runners(42, tag_list: 'tag1,tag2')
|
80
110
|
#
|
81
111
|
# @param [Integer, String] id The ID or name of a project.
|
112
|
+
# @param [Hash] options A customizable set of options.
|
113
|
+
# @option options [String] :type(optional) The type of runners to show, one of: instance_type, group_type, project_type
|
114
|
+
# @option options [String] :status(optional) The status of runners to show, one of: active, paused, online, offline
|
115
|
+
# @option options [String] :tag_list(optional) List of the runners tags (separated by comma)
|
82
116
|
# @return [Array<Gitlab::ObjectifiedHash>]
|
83
|
-
def project_runners(project_id)
|
84
|
-
get("/projects/#{url_encode project_id}/runners")
|
117
|
+
def project_runners(project_id, options = {})
|
118
|
+
get("/projects/#{url_encode project_id}/runners", query: options)
|
85
119
|
end
|
86
120
|
|
87
121
|
# Enable an available specific runner in the project.
|
@@ -111,5 +145,67 @@ class Gitlab::Client
|
|
111
145
|
delete("/projects/#{url_encode id}/runners/#{runner_id}")
|
112
146
|
end
|
113
147
|
|
148
|
+
# List all runners (specific and shared) available in the group as well its ancestor groups. Shared runners are listed if at least one shared runner is defined.
|
149
|
+
# @see https://docs.gitlab.com/ee/api/runners.html#list-groups-runners
|
150
|
+
#
|
151
|
+
# @example
|
152
|
+
# Gitlab.group_runners(9)
|
153
|
+
# Gitlab.group_runners(9, type: 'instance_type', status: 'active')
|
154
|
+
# Gitlab.group_runners(9, tag_list: 'tag1,tag2')
|
155
|
+
#
|
156
|
+
# @param [Integer, String] id The ID or name of a project.
|
157
|
+
# @param [Hash] options A customizable set of options.
|
158
|
+
# @option options [String] :type(optional) The type of runners to show, one of: instance_type, group_type, project_type
|
159
|
+
# @option options [String] :status(optional) The status of runners to show, one of: active, paused, online, offline
|
160
|
+
# @option options [String] :tag_list(optional) List of the runners tags (separated by comma)
|
161
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
162
|
+
def group_runners(group, options = {})
|
163
|
+
get("/groups/#{url_encode group}/runners", query: options)
|
164
|
+
end
|
165
|
+
|
166
|
+
# Register a new Runner for the instance.
|
167
|
+
#
|
168
|
+
# @example
|
169
|
+
# Gitlab.register_runner('9142c16ea169eaaea3d752313a434a6e')
|
170
|
+
# Gitlab.register_runner('9142c16ea169eaaea3d752313a434a6e', description: 'Some Description', active: true, locked: false)
|
171
|
+
#
|
172
|
+
# @param [String] token(required) Registration token.
|
173
|
+
# @param [Hash] options A customizable set of options.
|
174
|
+
# @option options [String] :description(optional) Runner description.
|
175
|
+
# @option options [Hash] :info(optional) Runner metadata.
|
176
|
+
# @option options [Boolean] :active(optional) Whether the Runner is active.
|
177
|
+
# @option options [Boolean] :locked(optional) Whether the Runner should be locked for current project.
|
178
|
+
# @option options [Boolean] :run_untagged(optional) Whether the Runner should handle untagged jobs.
|
179
|
+
# @option options [Array<String>] :tag_list(optional) List of Runner tags.
|
180
|
+
# @option options [Integer] :maximum_timeout(optional) Maximum timeout set when this Runner will handle the job.
|
181
|
+
# @return <Gitlab::ObjectifiedHash> Response against runner registration
|
182
|
+
def register_runner(token, options = {})
|
183
|
+
body = { token: token }.merge(options)
|
184
|
+
post('/runners', body: body)
|
185
|
+
end
|
186
|
+
|
187
|
+
# Deletes a registed Runner.
|
188
|
+
#
|
189
|
+
# @example
|
190
|
+
# Gitlab.delete_registered_runner('9142c16ea169eaaea3d752313a434a6e')
|
191
|
+
#
|
192
|
+
# @param [String] token Runner authentication token.
|
193
|
+
# @return [nil] This API call returns an empty response body.
|
194
|
+
def delete_registered_runner(token)
|
195
|
+
body = { token: token }
|
196
|
+
delete('/runners', body: body)
|
197
|
+
end
|
198
|
+
|
199
|
+
# Validates authentication credentials for a registered Runner.
|
200
|
+
#
|
201
|
+
# @example
|
202
|
+
# Gitlab.verify_auth_registered_runner('9142c16ea169eaaea3d752313a434a6e')
|
203
|
+
#
|
204
|
+
# @param [String] token Runner authentication token.
|
205
|
+
# @return [nil] This API call returns an empty response body.
|
206
|
+
def verify_auth_registered_runner(token)
|
207
|
+
body = { token: token }
|
208
|
+
post('/runners/verify', body: body)
|
209
|
+
end
|
114
210
|
end
|
115
211
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to global searches, searching in projects and searching in groups.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/search.html
|
6
|
+
module Search
|
7
|
+
# Search globally across the GitLab instance.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.search_globally('projects', 'gitlab')
|
11
|
+
# Gitlab.search_globally('issues', 'gitlab')
|
12
|
+
# Gitlab.search_globally('merge_requests', 'gitlab')
|
13
|
+
# Gitlab.search_globally('milestones', 'gitlab')
|
14
|
+
# Gitlab.search_globally('snippet_titles', 'gitlab')
|
15
|
+
# Gitlab.search_globally('snippet_blobs', 'gitlab')
|
16
|
+
#
|
17
|
+
# @param [String] scope The scope to search in. Currently these scopes are supported: projects, issues, merge_requests, milestones, snippet_titles, snippet_blobs.
|
18
|
+
# @param [String] search The search query.
|
19
|
+
# @return [Array<Gitlab::ObjectifiedHash>] Returns a list of responses depending on the requested scope.
|
20
|
+
def search_globally(scope, search)
|
21
|
+
options = { scope: scope, search: search }
|
22
|
+
get('/search', query: options)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Search within the specified group.
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# Gitlab.search_in_group(1, 'projects', 'gitlab')
|
29
|
+
# Gitlab.search_in_group(1, 'issues', 'gitlab')
|
30
|
+
# Gitlab.search_in_group(1, 'merge_requests', 'gitlab')
|
31
|
+
# Gitlab.search_in_group(1, 'milestones', 'gitlab')
|
32
|
+
#
|
33
|
+
# @param [Integer, String] group The ID or name of a group.
|
34
|
+
# @param [String] scope The scope to search in. Currently these scopes are supported: projects, issues, merge_requests, milestones.
|
35
|
+
# @param [String] search The search query.
|
36
|
+
# @return [Array<Gitlab::ObjectifiedHash>] Returns a list of responses depending on the requested scope.
|
37
|
+
def search_in_group(group, scope, search)
|
38
|
+
options = { scope: scope, search: search }
|
39
|
+
get("/groups/#{url_encode group}/search", query: options)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Search within the specified project.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
# Gitlab.search_in_project(1, 'issues', 'gitlab')
|
46
|
+
# Gitlab.search_in_project(1, 'merge_requests', 'gitlab')
|
47
|
+
# Gitlab.search_in_project(1, 'milestones', 'gitlab')
|
48
|
+
# Gitlab.search_in_project(1, 'notes', 'gitlab')
|
49
|
+
# Gitlab.search_in_project(1, 'wiki_blobs', 'gitlab')
|
50
|
+
# Gitlab.search_in_project(1, 'commits', 'gitlab')
|
51
|
+
# Gitlab.search_in_project(1, 'blobs', 'gitlab')
|
52
|
+
#
|
53
|
+
# @param [Integer, String] project The ID or name of a project.
|
54
|
+
# @param [String] scope The scope to search in. Currently these scopes are supported: issues, merge_requests, milestones, notes, wiki_blobs, commits, blobs.
|
55
|
+
# @param [String] search The search query.
|
56
|
+
# @return [Array<Gitlab::ObjectifiedHash>] Returns a list of responses depending on the requested scope.
|
57
|
+
def search_in_project(project, scope, search, ref = nil)
|
58
|
+
options = { scope: scope, search: search }
|
59
|
+
|
60
|
+
# Add ref filter if provided - backward compatible with main project
|
61
|
+
options[:ref] = ref unless ref.nil?
|
62
|
+
|
63
|
+
get("/projects/#{url_encode project}/search", query: options)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Gitlab::Client
|
2
4
|
# Third party services connected to a project.
|
3
5
|
# @see https://docs.gitlab.com/ce/api/services.html
|
@@ -43,8 +45,9 @@ class Gitlab::Client
|
|
43
45
|
end
|
44
46
|
|
45
47
|
private
|
48
|
+
|
46
49
|
def correct_service_name(service)
|
47
|
-
service.to_s.
|
50
|
+
service.to_s.tr('_', '-')
|
48
51
|
end
|
49
52
|
end
|
50
53
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to sidekiq metrics.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/sidekiq_metrics.html
|
6
|
+
module Sidekiq
|
7
|
+
# Get the current Queue Metrics
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.sidekiq_queue_metrics
|
11
|
+
def sidekiq_queue_metrics
|
12
|
+
get('/sidekiq/queue_metrics')
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get the current Process Metrics
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
# Gitlab.sidekiq_process_metrics
|
19
|
+
def sidekiq_process_metrics
|
20
|
+
get('/sidekiq/process_metrics')
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get the current Job Statistics
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# Gitlab.sidekiq_job_stats
|
27
|
+
def sidekiq_job_stats
|
28
|
+
get('/sidekiq/job_stats')
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get a compound response of all the previously mentioned metrics
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# Gitlab.sidekiq_compound_metrics
|
35
|
+
def sidekiq_compound_metrics
|
36
|
+
get('/sidekiq/compound_metrics')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Gitlab::Client
|
2
4
|
# Defines methods related to snippets.
|
3
5
|
# @see https://docs.gitlab.com/ce/api/project_snippets.html
|
@@ -12,7 +14,7 @@ class Gitlab::Client
|
|
12
14
|
# @option options [Integer] :page The page number.
|
13
15
|
# @option options [Integer] :per_page The number of results per page.
|
14
16
|
# @return [Gitlab::ObjectifiedHash]
|
15
|
-
def snippets(project, options={})
|
17
|
+
def snippets(project, options = {})
|
16
18
|
get("/projects/#{url_encode project}/snippets", query: options)
|
17
19
|
end
|
18
20
|
|
@@ -31,7 +33,7 @@ class Gitlab::Client
|
|
31
33
|
# Creates a new snippet.
|
32
34
|
#
|
33
35
|
# @example
|
34
|
-
# Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code' })
|
36
|
+
# Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code', visibility: 'public'})
|
35
37
|
#
|
36
38
|
# @param [Integer, String] project The ID or name of a project.
|
37
39
|
# @param [Hash] options A customizable set of options.
|
@@ -39,8 +41,9 @@ class Gitlab::Client
|
|
39
41
|
# @option options [String] :file_name (required) The name of a snippet file.
|
40
42
|
# @option options [String] :code (required) The content of a snippet.
|
41
43
|
# @option options [String] :lifetime (optional) The expiration date of a snippet.
|
44
|
+
# @option options [String] :visibility (required) The visibility of a snippet
|
42
45
|
# @return [Gitlab::ObjectifiedHash] Information about created snippet.
|
43
|
-
def create_snippet(project, options={})
|
46
|
+
def create_snippet(project, options = {})
|
44
47
|
post("/projects/#{url_encode project}/snippets", body: options)
|
45
48
|
end
|
46
49
|
|
@@ -56,8 +59,9 @@ class Gitlab::Client
|
|
56
59
|
# @option options [String] :file_name The name of a snippet file.
|
57
60
|
# @option options [String] :code The content of a snippet.
|
58
61
|
# @option options [String] :lifetime The expiration date of a snippet.
|
62
|
+
# @option options [String] :visibility (optional) The visibility of a snippet
|
59
63
|
# @return [Gitlab::ObjectifiedHash] Information about updated snippet.
|
60
|
-
def edit_snippet(project, id, options={})
|
64
|
+
def edit_snippet(project, id, options = {})
|
61
65
|
put("/projects/#{url_encode project}/snippets/#{id}", body: options)
|
62
66
|
end
|
63
67
|
|