fs-gitlab 4.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +270 -0
  3. data/LICENSE.txt +24 -0
  4. data/README.md +260 -0
  5. data/exe/gitlab +11 -0
  6. data/lib/gitlab/api.rb +24 -0
  7. data/lib/gitlab/cli.rb +89 -0
  8. data/lib/gitlab/cli_helpers.rb +243 -0
  9. data/lib/gitlab/client/access_requests.rb +103 -0
  10. data/lib/gitlab/client/application_settings.rb +172 -0
  11. data/lib/gitlab/client/avatar.rb +21 -0
  12. data/lib/gitlab/client/award_emojis.rb +137 -0
  13. data/lib/gitlab/client/boards.rb +146 -0
  14. data/lib/gitlab/client/branches.rb +135 -0
  15. data/lib/gitlab/client/broadcast_messages.rb +75 -0
  16. data/lib/gitlab/client/build_variables.rb +135 -0
  17. data/lib/gitlab/client/builds.rb +108 -0
  18. data/lib/gitlab/client/commits.rb +216 -0
  19. data/lib/gitlab/client/container_registry.rb +85 -0
  20. data/lib/gitlab/client/deployments.rb +34 -0
  21. data/lib/gitlab/client/environments.rb +89 -0
  22. data/lib/gitlab/client/epic_issues.rb +23 -0
  23. data/lib/gitlab/client/epics.rb +73 -0
  24. data/lib/gitlab/client/events.rb +60 -0
  25. data/lib/gitlab/client/features.rb +48 -0
  26. data/lib/gitlab/client/group_badges.rb +88 -0
  27. data/lib/gitlab/client/group_boards.rb +141 -0
  28. data/lib/gitlab/client/group_labels.rb +88 -0
  29. data/lib/gitlab/client/group_milestones.rb +94 -0
  30. data/lib/gitlab/client/groups.rb +358 -0
  31. data/lib/gitlab/client/issue_links.rb +48 -0
  32. data/lib/gitlab/client/issues.rb +231 -0
  33. data/lib/gitlab/client/jobs.rb +250 -0
  34. data/lib/gitlab/client/keys.rb +29 -0
  35. data/lib/gitlab/client/labels.rb +88 -0
  36. data/lib/gitlab/client/lint.rb +19 -0
  37. data/lib/gitlab/client/markdown.rb +23 -0
  38. data/lib/gitlab/client/merge_request_approvals.rb +265 -0
  39. data/lib/gitlab/client/merge_requests.rb +386 -0
  40. data/lib/gitlab/client/milestones.rb +106 -0
  41. data/lib/gitlab/client/namespaces.rb +22 -0
  42. data/lib/gitlab/client/notes.rb +313 -0
  43. data/lib/gitlab/client/packages.rb +95 -0
  44. data/lib/gitlab/client/pipeline_schedules.rb +147 -0
  45. data/lib/gitlab/client/pipeline_triggers.rb +103 -0
  46. data/lib/gitlab/client/pipelines.rb +105 -0
  47. data/lib/gitlab/client/project_badges.rb +85 -0
  48. data/lib/gitlab/client/project_clusters.rb +83 -0
  49. data/lib/gitlab/client/project_release_links.rb +76 -0
  50. data/lib/gitlab/client/project_releases.rb +79 -0
  51. data/lib/gitlab/client/projects.rb +708 -0
  52. data/lib/gitlab/client/protected_tags.rb +59 -0
  53. data/lib/gitlab/client/remote_mirrors.rb +51 -0
  54. data/lib/gitlab/client/repositories.rb +113 -0
  55. data/lib/gitlab/client/repository_files.rb +131 -0
  56. data/lib/gitlab/client/repository_submodules.rb +27 -0
  57. data/lib/gitlab/client/resource_label_events.rb +82 -0
  58. data/lib/gitlab/client/resource_state_events.rb +57 -0
  59. data/lib/gitlab/client/runners.rb +211 -0
  60. data/lib/gitlab/client/search.rb +66 -0
  61. data/lib/gitlab/client/services.rb +53 -0
  62. data/lib/gitlab/client/sidekiq.rb +39 -0
  63. data/lib/gitlab/client/snippets.rb +95 -0
  64. data/lib/gitlab/client/system_hooks.rb +64 -0
  65. data/lib/gitlab/client/tags.rb +97 -0
  66. data/lib/gitlab/client/templates.rb +100 -0
  67. data/lib/gitlab/client/todos.rb +46 -0
  68. data/lib/gitlab/client/user_snippets.rb +114 -0
  69. data/lib/gitlab/client/users.rb +397 -0
  70. data/lib/gitlab/client/versions.rb +18 -0
  71. data/lib/gitlab/client/wikis.rb +79 -0
  72. data/lib/gitlab/client.rb +95 -0
  73. data/lib/gitlab/configuration.rb +57 -0
  74. data/lib/gitlab/error.rb +170 -0
  75. data/lib/gitlab/file_response.rb +48 -0
  76. data/lib/gitlab/help.rb +94 -0
  77. data/lib/gitlab/objectified_hash.rb +51 -0
  78. data/lib/gitlab/page_links.rb +35 -0
  79. data/lib/gitlab/paginated_response.rb +110 -0
  80. data/lib/gitlab/request.rb +109 -0
  81. data/lib/gitlab/shell.rb +83 -0
  82. data/lib/gitlab/shell_history.rb +57 -0
  83. data/lib/gitlab/version.rb +5 -0
  84. data/lib/gitlab.rb +56 -0
  85. metadata +204 -0
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to Protected Tags.
5
+ # @see https://docs.gitlab.com/ce/api/protected_tags.html
6
+ module ProtectedTags
7
+ # Gets a list of protected tags from a project
8
+ #
9
+ # @example
10
+ # Gitlab.protected_tags(1)
11
+ #
12
+ # @param [Integer, String] project(required) The ID or name of a project.
13
+ # @option options [Integer] :page The page number.
14
+ # @option options [Integer] :per_page The number of results per page.
15
+ # @return [Array<Gitlab::ObjectifiedHash>] List of all protected tags requested
16
+ def protected_tags(project, options = {})
17
+ get("/projects/#{url_encode project}/protected_tags", query: options)
18
+ end
19
+
20
+ # Gets a single protected tag or wildcard protected tag.
21
+ #
22
+ # @example
23
+ # Gitlab.protected_tag(1, 'release-1-0')
24
+ #
25
+ # @param [Integer, String] project(required) The ID or name of a project.
26
+ # @param [String] name(required) The name of the tag or wildcard
27
+ # @return <Gitlab::ObjectifiedHash] Information about the requested protected tag
28
+ def protected_tag(project, name)
29
+ get("/projects/#{url_encode project}/protected_tags/#{name}")
30
+ end
31
+
32
+ # Protects a single repository tag or several project repository tags using a wildcard protected tag.
33
+ #
34
+ # @example
35
+ # Gitlab.protect_repository_tag(1, 'release-1-0')
36
+ # Gitlab.protect_repository_tag(1, 'release-1-0', create_access_level: 30)
37
+ #
38
+ # @param [Integer, String] project(required) The ID or name of a project.
39
+ # @param [String] name(required) The name of the tag or wildcard
40
+ # @option options [Integer] :create_access_level Access levels allowed to create (defaults: 40, maintainer access level)
41
+ # @return <Gitlab::ObjectifiedHash] Information about the protected repository tag
42
+ def protect_repository_tag(project, name, options = {})
43
+ body = { name: name }.merge(options)
44
+ post("/projects/#{url_encode project}/protected_tags", body: body)
45
+ end
46
+
47
+ # Unprotects the given protected tag or wildcard protected tag.
48
+ #
49
+ # @example
50
+ # Gitlab.unprotect_repository_tag(1, 'release-1-0')
51
+ #
52
+ # @param [Integer, String] project(required) The ID or name of a project.
53
+ # @param [String] name(required) The name of the tag or wildcard
54
+ # @return [nil] This API call returns an empty response body.
55
+ def unprotect_repository_tag(project, name)
56
+ delete("/projects/#{url_encode project}/protected_tags/#{name}")
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to remote mirrors.
5
+ # @see https://docs.gitlab.com/ee/api/remote_mirrors.html
6
+ module RemoteMirrors
7
+ # List a project's remote mirrors
8
+ #
9
+ # @example
10
+ # Gitlab.remote_mirrors(42)
11
+ # Gitlab.remote_mirrors('gitlab-org/gitlab')
12
+ #
13
+ # @param [Integer, String] project The ID or name of a project.
14
+ # @return [Array<Gitlab::ObjectifiedHash>]
15
+ def remote_mirrors(project)
16
+ get("/projects/#{url_encode project}/remote_mirrors")
17
+ end
18
+
19
+ # Create a remote mirror
20
+ #
21
+ # @example
22
+ # Gitlab.create_remote_mirror(42, 'https://mirror-bot@gitlab.com/gitlab-org/gitlab.git', enabled: true)
23
+ #
24
+ # @param [Integer, String] project The ID or name of a project.
25
+ # @param [String] url The full URL of the remote repository.
26
+ # @param [Hash] options A customizable set of options.
27
+ # @option options [Boolean] :enabled Determines if the mirror is enabled.
28
+ # @option options [Boolean] :only_protected_branches Determines if only protected branches are mirrored.
29
+ # @option options [Boolean] :keep_divergent_refs Determines if divergent refs are skipped.
30
+ # @return [Gitlab::ObjectifiedHash]
31
+ def create_remote_mirror(project, url, options = {})
32
+ post("/projects/#{url_encode project}/remote_mirrors", body: options.merge(url: url))
33
+ end
34
+
35
+ # Update a remote mirror's attributes
36
+ #
37
+ # @example
38
+ # Gitlab.edit_remote_mirror(42, 66, only_protected_branches: true)
39
+ #
40
+ # @param [Integer, String] project The ID or name of a project.
41
+ # @param [Integer] id The ID of the remote mirror.
42
+ # @param [Hash] options A customizable set of options.
43
+ # @option options [Boolean] :enabled Determines if the mirror is enabled.
44
+ # @option options [Boolean] :only_protected_branches Determines if only protected branches are mirrored.
45
+ # @option options [Boolean] :keep_divergent_refs Determines if divergent refs are skipped.
46
+ # @return [Gitlab::ObjectifiedHash]
47
+ def edit_remote_mirror(project, id, options = {})
48
+ put("/projects/#{url_encode project}/remote_mirrors/#{id}", body: options)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,113 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Gitlab::Client
4
+ # Defines methods related to repositories.
5
+ # @see https://docs.gitlab.com/ce/api/repositories.html
6
+ module Repositories
7
+ # Get file tree project (root level).
8
+ #
9
+ # @example
10
+ # Gitlab.tree(42)
11
+ # Gitlab.tree(42, { path: 'Gemfile' })
12
+ #
13
+ # @param [Integer, String] project The ID or name of a project.
14
+ # @param [Hash] options A customizable set of options.
15
+ # @option options [String] :path The path inside repository.
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)
18
+ # @return [Gitlab::ObjectifiedHash]
19
+ def tree(project, options = {})
20
+ get("/projects/#{url_encode project}/repository/tree", query: options)
21
+ end
22
+ alias repo_tree tree
23
+
24
+ # Get project repository archive
25
+ #
26
+ # @example
27
+ # Gitlab.repo_archive(42)
28
+ # Gitlab.repo_archive(42, 'deadbeef')
29
+ #
30
+ # @param [Integer, String] project The ID or name of a project.
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
33
+ # @return [Gitlab::FileResponse]
34
+ def repo_archive(project, ref = 'master', format = 'tar.gz')
35
+ get("/projects/#{url_encode project}/repository/archive.#{format}",
36
+ format: nil,
37
+ headers: { Accept: 'application/octet-stream' },
38
+ query: { sha: ref },
39
+ parser: proc { |body, _|
40
+ if body.encoding == Encoding::ASCII_8BIT # binary response
41
+ ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
42
+ else # error with json response
43
+ ::Gitlab::Request.parse(body)
44
+ end
45
+ })
46
+ end
47
+
48
+ # Compares branches, tags or commits.
49
+ #
50
+ # @example
51
+ # Gitlab.compare(42, 'master', 'feature/branch')
52
+ # Gitlab.repo_compare(42, 'master', 'feature/branch')
53
+ #
54
+ # @param [Integer] project The ID of a project.
55
+ # @param [String] from The commit SHA or branch name of from branch.
56
+ # @param [String] to The commit SHA or branch name of to branch.
57
+ # @return [Gitlab::ObjectifiedHash]
58
+ def compare(project, from, to)
59
+ get("/projects/#{url_encode project}/repository/compare", query: { from: from, to: to })
60
+ end
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
112
+ end
113
+ end
@@ -0,0 +1,131 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'base64'
4
+
5
+ class Gitlab::Client
6
+ # Defines methods related to repository files.
7
+ # @see https://docs.gitlab.com/ce/api/repository_files.html
8
+ module RepositoryFiles
9
+ # Get the contents of a file
10
+ #
11
+ # @example
12
+ # Gitlab.file_contents(42, 'Gemfile')
13
+ # Gitlab.repo_file_contents(3, 'Gemfile', 'ed899a2f4b50b4370feeea94676502b42383c746')
14
+ #
15
+ # @param [Integer, String] project The ID or name of a project.
16
+ # @param [String] filepath The relative path of the file in the repository
17
+ # @param [String] ref The name of a repository branch or tag or if not given the default branch.
18
+ # @return [String]
19
+ def file_contents(project, filepath, ref = 'master')
20
+ get "/projects/#{url_encode project}/repository/files/#{url_encode filepath}/raw",
21
+ query: { ref: ref },
22
+ format: nil,
23
+ headers: { Accept: 'text/plain' },
24
+ parser: ::Gitlab::Request::Parser
25
+ end
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
43
+
44
+ # Gets a repository file.
45
+ #
46
+ # @example
47
+ # Gitlab.get_file(42, "README.md", "master")
48
+ #
49
+ # @param [Integer, String] project The ID or name of a project.
50
+ # @param [String] file_path The full path of the file.
51
+ # @param [String] ref The name of branch, tag or commit.
52
+ # @return [Gitlab::ObjectifiedHash]
53
+ def get_file(project, file_path, ref)
54
+ get("/projects/#{url_encode project}/repository/files/#{url_encode file_path}", query: {
55
+ ref: ref
56
+ })
57
+ end
58
+
59
+ # Creates a new repository file.
60
+ #
61
+ # @example
62
+ # Gitlab.create_file(42, "path", "branch", "content", "commit message")
63
+ #
64
+ # @param [Integer, String] project The ID or name of a project.
65
+ # @param [String] path full path to new file.
66
+ # @param [String] branch the name of the branch.
67
+ # @param [String] content file content.
68
+ # @param [String] commit_message ...commit message.
69
+ # @param [Hash] options Optional additional details for commit
70
+ # @option options [String] :author_name Commit author's name
71
+ # @option options [String] :author_email Commit author's email address
72
+ # @return [Gitlab::ObjectifiedHash]
73
+ def create_file(project, path, branch, content, commit_message, options = {})
74
+ post("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: {
75
+ branch: branch,
76
+ commit_message: commit_message
77
+ }.merge(options).merge(encoded_content_attributes(content)))
78
+ end
79
+
80
+ # Edits an existing repository file.
81
+ #
82
+ # @example
83
+ # Gitlab.edit_file(42, "path", "branch", "content", "commit message")
84
+ #
85
+ # @param [Integer, String] project The ID or name of a project.
86
+ # @param [String] path full path of file to update.
87
+ # @param [String] branch the name of the branch to commit changes to.
88
+ # @param [String] content new file content.
89
+ # @param [String] commit_message ...commit message.
90
+ # @param [Hash] options Optional additional details for commit
91
+ # @option options [String] :author_name Commit author's name
92
+ # @option options [String] :author_email Commit author's email address
93
+ # @return [Gitlab::ObjectifiedHash]
94
+ def edit_file(project, path, branch, content, commit_message, options = {})
95
+ put("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: {
96
+ branch: branch,
97
+ commit_message: commit_message
98
+ }.merge(options).merge(encoded_content_attributes(content)))
99
+ end
100
+
101
+ # Removes an existing repository file.
102
+ #
103
+ # @example
104
+ # Gitlab.remove_file(42, "path", "branch", "commit message")
105
+ #
106
+ # @param [Integer, String] project The ID or name of a project.
107
+ # @param [String] path full path of file to delete.
108
+ # @param [String] branch the name of the branch to commit the deletion to.
109
+ # @param [String] commit_message ...a commit message ;)
110
+ # @param [Hash] options Optional additional details for commit
111
+ # @option options [String] :author_name Commit author's name
112
+ # @option options [String] :author_email Commit author's email address
113
+ # @return [Gitlab::ObjectifiedHash]
114
+ def remove_file(project, path, branch, commit_message, options = {})
115
+ delete("/projects/#{url_encode project}/repository/files/#{url_encode path}",
116
+ body: {
117
+ branch: branch,
118
+ commit_message: commit_message
119
+ }.merge(options))
120
+ end
121
+
122
+ private
123
+
124
+ def encoded_content_attributes(content)
125
+ {
126
+ encoding: 'base64',
127
+ content: Base64.encode64(content)
128
+ }
129
+ end
130
+ end
131
+ end
@@ -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