gitlab 4.5.0 → 4.6.0

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/stale.yml +18 -0
  3. data/.rubocop_todo.yml +46 -0
  4. data/Gemfile +2 -0
  5. data/README.md +22 -22
  6. data/Rakefile +3 -5
  7. data/bin/console +1 -0
  8. data/exe/gitlab +5 -1
  9. data/gitlab.gemspec +9 -6
  10. data/lib/gitlab.rb +6 -3
  11. data/lib/gitlab/api.rb +5 -3
  12. data/lib/gitlab/cli.rb +11 -5
  13. data/lib/gitlab/cli_helpers.rb +31 -22
  14. data/lib/gitlab/client.rb +7 -8
  15. data/lib/gitlab/client/access_requests.rb +100 -93
  16. data/lib/gitlab/client/award_emojis.rb +127 -127
  17. data/lib/gitlab/client/boards.rb +82 -82
  18. data/lib/gitlab/client/branches.rb +89 -89
  19. data/lib/gitlab/client/build_variables.rb +117 -117
  20. data/lib/gitlab/client/builds.rb +98 -98
  21. data/lib/gitlab/client/commits.rb +154 -154
  22. data/lib/gitlab/client/deployments.rb +29 -29
  23. data/lib/gitlab/client/environments.rb +80 -80
  24. data/lib/gitlab/client/events.rb +54 -54
  25. data/lib/gitlab/client/group_milestones.rb +85 -86
  26. data/lib/gitlab/client/groups.rb +178 -178
  27. data/lib/gitlab/client/issues.rb +195 -196
  28. data/lib/gitlab/client/jobs.rb +150 -150
  29. data/lib/gitlab/client/keys.rb +14 -14
  30. data/lib/gitlab/client/labels.rb +79 -79
  31. data/lib/gitlab/client/merge_request_approvals.rb +102 -102
  32. data/lib/gitlab/client/merge_requests.rb +281 -256
  33. data/lib/gitlab/client/milestones.rb +85 -85
  34. data/lib/gitlab/client/namespaces.rb +18 -18
  35. data/lib/gitlab/client/notes.rb +260 -260
  36. data/lib/gitlab/client/pipeline_schedules.rb +123 -123
  37. data/lib/gitlab/client/pipeline_triggers.rb +93 -93
  38. data/lib/gitlab/client/pipelines.rb +62 -62
  39. data/lib/gitlab/client/projects.rb +526 -505
  40. data/lib/gitlab/client/repositories.rb +68 -55
  41. data/lib/gitlab/client/repository_files.rb +103 -103
  42. data/lib/gitlab/client/runners.rb +113 -115
  43. data/lib/gitlab/client/services.rb +46 -45
  44. data/lib/gitlab/client/sidekiq.rb +32 -32
  45. data/lib/gitlab/client/snippets.rb +86 -86
  46. data/lib/gitlab/client/system_hooks.rb +57 -57
  47. data/lib/gitlab/client/tags.rb +87 -88
  48. data/lib/gitlab/client/todos.rb +41 -41
  49. data/lib/gitlab/client/users.rb +242 -228
  50. data/lib/gitlab/client/versions.rb +16 -0
  51. data/lib/gitlab/configuration.rb +7 -5
  52. data/lib/gitlab/error.rb +3 -1
  53. data/lib/gitlab/file_response.rb +4 -2
  54. data/lib/gitlab/help.rb +9 -9
  55. data/lib/gitlab/objectified_hash.rb +5 -4
  56. data/lib/gitlab/page_links.rb +9 -7
  57. data/lib/gitlab/paginated_response.rb +14 -4
  58. data/lib/gitlab/request.rb +8 -5
  59. data/lib/gitlab/shell.rb +6 -4
  60. data/lib/gitlab/shell_history.rb +7 -5
  61. data/lib/gitlab/version.rb +3 -1
  62. metadata +8 -5
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gitlab
2
4
  # Wrapper for the Gitlab REST API.
3
5
  class Client < API
4
- Dir[File.expand_path('../client/*.rb', __FILE__)].each { |f| require f }
6
+ Dir[File.expand_path('client/*.rb', __dir__)].each { |f| require f }
5
7
 
6
8
  # Please keep in alphabetical order
7
9
  include AccessRequests
@@ -39,22 +41,19 @@ module Gitlab
39
41
  include Tags
40
42
  include Todos
41
43
  include Users
44
+ include Versions
42
45
 
43
46
  # Text representation of the client, masking private token.
44
47
  #
45
48
  # @return [String]
46
49
  def inspect
47
50
  inspected = super
48
-
49
- if @private_token
50
- inspected = inspected.sub! @private_token, only_show_last_four_chars(@private_token)
51
- end
52
-
51
+ inspected.sub! @private_token, only_show_last_four_chars(@private_token) if @private_token
53
52
  inspected
54
53
  end
55
54
 
56
- def url_encode(s)
57
- URI.encode(s.to_s, /\W/)
55
+ def url_encode(url)
56
+ URI.encode(url.to_s, /\W/)
58
57
  end
59
58
 
60
59
  private
@@ -1,94 +1,101 @@
1
- class Gitlab::Client
2
- # Defines methods related to Award Emojis.
3
- # @see https://docs.gitlab.com/ce/api/access_requests.html
4
- module AccessRequests
5
- # Gets a list of access requests for a project viewable by the authenticated user.
6
- #
7
- # @example
8
- # Gitlab.project_access_requests(1)
9
- #
10
- # @param [Integer, String] :project(required) The ID or name of a project.
11
- # @return [Array<Gitlab::ObjectifiedHash>] List of project access requests
12
- def project_access_requests(project)
13
- get("/projects/#{url_encode project}/access_requests")
14
- end
15
- # Gets a list of access requests for a group viewable by the authenticated user.
16
- #
17
- # @example
18
- # Gitlab.group_access_requests(1)
19
- #
20
- # @param [Integer, String] :group(required) The ID or name of a group.
21
- # @return [Array<Gitlab::ObjectifiedHash>] List of group access requests
22
- def group_access_requests(group)
23
- get("/groups/#{url_encode group}/access_requests")
24
- end
25
- # Requests access for the authenticated user to a project.
26
- #
27
- # @example
28
- # Gitlab.request_project_access(1)
29
- #
30
- # @param [Integer, String] :project(required) The ID or name of a project.
31
- # @return <Gitlab::ObjectifiedHash] Information about the requested project access
32
- def request_project_access(project)
33
- post("/projects/#{url_encode project}/access_requests")
34
- end
35
- # Requests access for the authenticated user to a group.
36
- #
37
- # @example
38
- # Gitlab.request_group_access(1)
39
- #
40
- # @param [Integer, String] :group(required) The ID or name of a group.
41
- # @return <Gitlab::ObjectifiedHash] Information about the requested group access
42
- def request_group_access(group)
43
- post("/groups/#{url_encode group}/access_requests")
44
- end
45
- # Approves a project access request for the given user.
46
- #
47
- # @example
48
- # Gitlab.approve_project_access_request(1, 1)
49
- # Gitlab.approve_project_access_request(1, 1, {access_level: '30'})
50
- #
51
- # @param [Integer, String] :project(required) The ID or name of a project.
52
- # @param [Integer] :user_id(required) The user ID of the access requester
53
- # @option options [Integer] :access_level(optional) A valid access level (defaults: 30, developer access level)
54
- # @return <Gitlab::ObjectifiedHash] Information about the approved project access request
55
- def approve_project_access_request(project, user_id, options = {})
56
- put("/projects/#{url_encode project}/access_requests/#{user_id}/approve", body: options)
57
- end
58
- # Approves a group access request for the given user.
59
- #
60
- # @example
61
- # Gitlab.approve_group_access_request(1, 1)
62
- # Gitlab.approve_group_access_request(1, 1, {access_level: '30'})
63
- #
64
- # @param [Integer, String] :group(required) The ID or name of a group.
65
- # @param [Integer] :user_id(required) The user ID of the access requester
66
- # @option options [Integer] :access_level(optional) A valid access level (defaults: 30, developer access level)
67
- # @return <Gitlab::ObjectifiedHash] Information about the approved group access request
68
- def approve_group_access_request(group, user_id, options = {})
69
- put("/groups/#{url_encode group}/access_requests/#{user_id}/approve", body: options)
70
- end
71
- # Denies a project access request for the given user.
72
- #
73
- # @example
74
- # Gitlab.deny_project_access_request(1, 1)
75
- #
76
- # @param [Integer, String] :project(required) The ID or name of a project.
77
- # @param [Integer] :user_id(required) The user ID of the access requester
78
- # @return [void] This API call returns an empty response body.
79
- def deny_project_access_request(project, user_id)
80
- delete("/projects/#{url_encode project}/access_requests/#{user_id}")
81
- end
82
- # Denies a group access request for the given user.
83
- #
84
- # @example
85
- # Gitlab.deny_group_access_request(1, 1)
86
- #
87
- # @param [Integer, String] :group(required) The ID or name of a group.
88
- # @param [Integer] :user_id(required) The user ID of the access requester
89
- # @return [void] This API call returns an empty response body.
90
- def deny_group_access_request(group, user_id)
91
- delete("/groups/#{url_encode group}/access_requests/#{user_id}")
92
- end
1
+ # frozen_string_literal: true
2
+
3
+ # Defines methods related to Award Emojis.
4
+ # @see https://docs.gitlab.com/ce/api/access_requests.html
5
+ module AccessRequests
6
+ # Gets a list of access requests for a project viewable by the authenticated user.
7
+ #
8
+ # @example
9
+ # Gitlab.project_access_requests(1)
10
+ #
11
+ # @param [Integer, String] :project(required) The ID or name of a project.
12
+ # @return [Array<Gitlab::ObjectifiedHash>] List of project access requests
13
+ def project_access_requests(project)
14
+ get("/projects/#{url_encode project}/access_requests")
93
15
  end
94
- end
16
+
17
+ # Gets a list of access requests for a group viewable by the authenticated user.
18
+ #
19
+ # @example
20
+ # Gitlab.group_access_requests(1)
21
+ #
22
+ # @param [Integer, String] :group(required) The ID or name of a group.
23
+ # @return [Array<Gitlab::ObjectifiedHash>] List of group access requests
24
+ def group_access_requests(group)
25
+ get("/groups/#{url_encode group}/access_requests")
26
+ end
27
+
28
+ # Requests access for the authenticated user to a project.
29
+ #
30
+ # @example
31
+ # Gitlab.request_project_access(1)
32
+ #
33
+ # @param [Integer, String] :project(required) The ID or name of a project.
34
+ # @return <Gitlab::ObjectifiedHash] Information about the requested project access
35
+ def request_project_access(project)
36
+ post("/projects/#{url_encode project}/access_requests")
37
+ end
38
+
39
+ # Requests access for the authenticated user to a group.
40
+ #
41
+ # @example
42
+ # Gitlab.request_group_access(1)
43
+ #
44
+ # @param [Integer, String] :group(required) The ID or name of a group.
45
+ # @return <Gitlab::ObjectifiedHash] Information about the requested group access
46
+ def request_group_access(group)
47
+ post("/groups/#{url_encode group}/access_requests")
48
+ end
49
+
50
+ # Approves a project access request for the given user.
51
+ #
52
+ # @example
53
+ # Gitlab.approve_project_access_request(1, 1)
54
+ # Gitlab.approve_project_access_request(1, 1, {access_level: '30'})
55
+ #
56
+ # @param [Integer, String] :project(required) The ID or name of a project.
57
+ # @param [Integer] :user_id(required) The user ID of the access requester
58
+ # @option options [Integer] :access_level(optional) A valid access level (defaults: 30, developer access level)
59
+ # @return <Gitlab::ObjectifiedHash] Information about the approved project access request
60
+ def approve_project_access_request(project, user_id, options = {})
61
+ put("/projects/#{url_encode project}/access_requests/#{user_id}/approve", body: options)
62
+ end
63
+
64
+ # Approves a group access request for the given user.
65
+ #
66
+ # @example
67
+ # Gitlab.approve_group_access_request(1, 1)
68
+ # Gitlab.approve_group_access_request(1, 1, {access_level: '30'})
69
+ #
70
+ # @param [Integer, String] :group(required) The ID or name of a group.
71
+ # @param [Integer] :user_id(required) The user ID of the access requester
72
+ # @option options [Integer] :access_level(optional) A valid access level (defaults: 30, developer access level)
73
+ # @return <Gitlab::ObjectifiedHash] Information about the approved group access request
74
+ def approve_group_access_request(group, user_id, options = {})
75
+ put("/groups/#{url_encode group}/access_requests/#{user_id}/approve", body: options)
76
+ end
77
+
78
+ # Denies a project access request for the given user.
79
+ #
80
+ # @example
81
+ # Gitlab.deny_project_access_request(1, 1)
82
+ #
83
+ # @param [Integer, String] :project(required) The ID or name of a project.
84
+ # @param [Integer] :user_id(required) The user ID of the access requester
85
+ # @return [void] This API call returns an empty response body.
86
+ def deny_project_access_request(project, user_id)
87
+ delete("/projects/#{url_encode project}/access_requests/#{user_id}")
88
+ end
89
+
90
+ # Denies a group access request for the given user.
91
+ #
92
+ # @example
93
+ # Gitlab.deny_group_access_request(1, 1)
94
+ #
95
+ # @param [Integer, String] :group(required) The ID or name of a group.
96
+ # @param [Integer] :user_id(required) The user ID of the access requester
97
+ # @return [void] This API call returns an empty response body.
98
+ def deny_group_access_request(group, user_id)
99
+ delete("/groups/#{url_encode group}/access_requests/#{user_id}")
100
+ end
101
+ end
@@ -1,135 +1,135 @@
1
- class Gitlab::Client
2
- # Defines methods related to Award Emojis.
3
- # @see https://docs.gitlab.com/ce/api/award_emoji.html
4
- module AwardEmojis
5
- # Gets a list of all award emoji for an awardable(issue, merge request or snippet)
6
- #
7
- # @example
8
- # Gitlab.award_emojis(1, 80, 'issue')
9
- # Gitlab.award_emojis(1, 60, 'merge_request')
10
- # Gitlab.award_emojis(1, 40, 'snippet')
11
- #
12
- # @param [Integer] project The ID of a project.
13
- # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
14
- # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
15
- # @return [Array<Gitlab::ObjectifiedHash>]
16
- def award_emojis(project, awardable_id, awardable_type)
17
- get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji")
18
- end
1
+ # frozen_string_literal: true
19
2
 
20
- # Gets a list of all award emoji for a single note on an awardable(issue, merge request or snippet)
21
- #
22
- # @example
23
- # Gitlab.note_award_emojis(1, 80, 'issue', 1)
24
- # Gitlab.note_award_emojis(1, 60, 'merge_request', 1)
25
- # Gitlab.note_award_emojis(1, 40, 'snippet', 1)
26
- #
27
- # @param [Integer] project The ID of a project.
28
- # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
29
- # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
30
- # @param [Integer] note_id The ID of a note.
31
- # @return [Array<Gitlab::ObjectifiedHash>]
32
- def note_award_emojis(project, awardable_id, awardable_type, note_id)
33
- get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji")
34
- end
3
+ # Defines methods related to Award Emojis.
4
+ # @see https://docs.gitlab.com/ce/api/award_emoji.html
5
+ module AwardEmojis
6
+ # Gets a list of all award emoji for an awardable(issue, merge request or snippet)
7
+ #
8
+ # @example
9
+ # Gitlab.award_emojis(1, 80, 'issue')
10
+ # Gitlab.award_emojis(1, 60, 'merge_request')
11
+ # Gitlab.award_emojis(1, 40, 'snippet')
12
+ #
13
+ # @param [Integer] project The ID of a project.
14
+ # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
15
+ # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
16
+ # @return [Array<Gitlab::ObjectifiedHash>]
17
+ def award_emojis(project, awardable_id, awardable_type)
18
+ get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji")
19
+ end
20
+
21
+ # Gets a list of all award emoji for a single note on an awardable(issue, merge request or snippet)
22
+ #
23
+ # @example
24
+ # Gitlab.note_award_emojis(1, 80, 'issue', 1)
25
+ # Gitlab.note_award_emojis(1, 60, 'merge_request', 1)
26
+ # Gitlab.note_award_emojis(1, 40, 'snippet', 1)
27
+ #
28
+ # @param [Integer] project The ID of a project.
29
+ # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
30
+ # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
31
+ # @param [Integer] note_id The ID of a note.
32
+ # @return [Array<Gitlab::ObjectifiedHash>]
33
+ def note_award_emojis(project, awardable_id, awardable_type, note_id)
34
+ get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji")
35
+ end
35
36
 
36
- # Gets a single award emoji for an awardable(issue, merge request or snippet)
37
- #
38
- # @example
39
- # Gitlab.award_emoji(1, 80, 'issue', 4)
40
- # Gitlab.award_emoji(1, 60, 'merge_request', 4)
41
- # Gitlab.award_emoji(1, 40, 'snippet', 4)
42
- #
43
- # @param [Integer] project The ID of a project.
44
- # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
45
- # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
46
- # @param [Integer] award_id The ID of an award emoji.
47
- # @return [Gitlab::ObjectifiedHash]
48
- def award_emoji(project, awardable_id, awardable_type, award_id)
49
- get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji/#{award_id}")
50
- end
37
+ # Gets a single award emoji for an awardable(issue, merge request or snippet)
38
+ #
39
+ # @example
40
+ # Gitlab.award_emoji(1, 80, 'issue', 4)
41
+ # Gitlab.award_emoji(1, 60, 'merge_request', 4)
42
+ # Gitlab.award_emoji(1, 40, 'snippet', 4)
43
+ #
44
+ # @param [Integer] project The ID of a project.
45
+ # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
46
+ # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
47
+ # @param [Integer] award_id The ID of an award emoji.
48
+ # @return [Gitlab::ObjectifiedHash]
49
+ def award_emoji(project, awardable_id, awardable_type, award_id)
50
+ get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji/#{award_id}")
51
+ end
51
52
 
52
- # Gets a single award emoji from a single note on an awardable(issue, merge request or snippet)
53
- #
54
- # @example
55
- # Gitlab.note_award_emoji(1, 80, 'issue', 1, 4)
56
- # Gitlab.note_award_emoji(1, 60, 'merge_request', 1, 4)
57
- # Gitlab.note_award_emoji(1, 40, 'snippet', 1, 4)
58
- #
59
- # @param [Integer] project The ID of a project.
60
- # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
61
- # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
62
- # @param [Integer] note_id The ID of a note.
63
- # @param [Integer] award_id The ID of an award emoji.
64
- # @return [Gitlab::ObjectifiedHash]
65
- def note_award_emoji(project, awardable_id, awardable_type, note_id, award_id)
66
- get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}")
67
- end
53
+ # Gets a single award emoji from a single note on an awardable(issue, merge request or snippet)
54
+ #
55
+ # @example
56
+ # Gitlab.note_award_emoji(1, 80, 'issue', 1, 4)
57
+ # Gitlab.note_award_emoji(1, 60, 'merge_request', 1, 4)
58
+ # Gitlab.note_award_emoji(1, 40, 'snippet', 1, 4)
59
+ #
60
+ # @param [Integer] project The ID of a project.
61
+ # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
62
+ # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
63
+ # @param [Integer] note_id The ID of a note.
64
+ # @param [Integer] award_id The ID of an award emoji.
65
+ # @return [Gitlab::ObjectifiedHash]
66
+ def note_award_emoji(project, awardable_id, awardable_type, note_id, award_id)
67
+ get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}")
68
+ end
68
69
 
69
- # Awards a new emoji to an awardable(issue, merge request or snippet)
70
- #
71
- # @example
72
- # Gitlab.create_award_emoji(1, 80, 'issue', 'blowfish')
73
- # Gitlab.create_award_emoji(1, 80, 'merge_request', 'blowfish')
74
- # Gitlab.create_award_emoji(1, 80, 'snippet', 'blowfish')
75
- #
76
- # @param [Integer] project The ID of a project.
77
- # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
78
- # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
79
- # @param [String] emoji_name The name of the emoji, without colons.
80
- # @return [Gitlab::ObjectifiedHash]
81
- def create_award_emoji(project, awardable_id, awardable_type, emoji_name)
82
- post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji", body: {name: emoji_name})
83
- end
70
+ # Awards a new emoji to an awardable(issue, merge request or snippet)
71
+ #
72
+ # @example
73
+ # Gitlab.create_award_emoji(1, 80, 'issue', 'blowfish')
74
+ # Gitlab.create_award_emoji(1, 80, 'merge_request', 'blowfish')
75
+ # Gitlab.create_award_emoji(1, 80, 'snippet', 'blowfish')
76
+ #
77
+ # @param [Integer] project The ID of a project.
78
+ # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
79
+ # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
80
+ # @param [String] emoji_name The name of the emoji, without colons.
81
+ # @return [Gitlab::ObjectifiedHash]
82
+ def create_award_emoji(project, awardable_id, awardable_type, emoji_name)
83
+ post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji", body: { name: emoji_name })
84
+ end
84
85
 
85
- # Awards a new emoji to a note on an awardable(issue, merge request or snippet)
86
- #
87
- # @example
88
- # Gitlab.create_note_award_emoji(1, 80, 'issue', 1, 'blowfish')
89
- # Gitlab.create_note_award_emoji(1, 80, 'merge_request', 1, 'blowfish')
90
- # Gitlab.create_note_award_emoji(1, 80, 'snippet', 1, 'blowfish')
91
- #
92
- # @param [Integer] project The ID of a project.
93
- # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
94
- # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
95
- # @param [Integer] note_id The ID of a note.
96
- # @param [String] emoji_name The name of the emoji, without colons.
97
- # @return [Gitlab::ObjectifiedHash]
98
- def create_note_award_emoji(project, awardable_id, awardable_type, note_id, emoji_name)
99
- post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji", body: {name: emoji_name})
100
- end
86
+ # Awards a new emoji to a note on an awardable(issue, merge request or snippet)
87
+ #
88
+ # @example
89
+ # Gitlab.create_note_award_emoji(1, 80, 'issue', 1, 'blowfish')
90
+ # Gitlab.create_note_award_emoji(1, 80, 'merge_request', 1, 'blowfish')
91
+ # Gitlab.create_note_award_emoji(1, 80, 'snippet', 1, 'blowfish')
92
+ #
93
+ # @param [Integer] project The ID of a project.
94
+ # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
95
+ # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
96
+ # @param [Integer] note_id The ID of a note.
97
+ # @param [String] emoji_name The name of the emoji, without colons.
98
+ # @return [Gitlab::ObjectifiedHash]
99
+ def create_note_award_emoji(project, awardable_id, awardable_type, note_id, emoji_name)
100
+ post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji", body: { name: emoji_name })
101
+ end
101
102
 
102
- # Deletes a single award emoji from an awardable(issue, merge request or snippet)
103
- #
104
- # @example
105
- # Gitlab.delete_award_emoji(1, 80, 'issue', 4)
106
- # Gitlab.delete_award_emoji(1, 60, 'merge_request', 4)
107
- # Gitlab.delete_award_emoji(1, 40, 'snippet', 4)
108
- #
109
- # @param [Integer] project The ID of a project.
110
- # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
111
- # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
112
- # @param [Integer] award_id The ID of an award emoji.
113
- # @return [void] This API call returns an empty response body.
114
- def delete_award_emoji(project, awardable_id, awardable_type, award_id)
115
- delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji/#{award_id}")
116
- end
103
+ # Deletes a single award emoji from an awardable(issue, merge request or snippet)
104
+ #
105
+ # @example
106
+ # Gitlab.delete_award_emoji(1, 80, 'issue', 4)
107
+ # Gitlab.delete_award_emoji(1, 60, 'merge_request', 4)
108
+ # Gitlab.delete_award_emoji(1, 40, 'snippet', 4)
109
+ #
110
+ # @param [Integer] project The ID of a project.
111
+ # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
112
+ # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
113
+ # @param [Integer] award_id The ID of an award emoji.
114
+ # @return [void] This API call returns an empty response body.
115
+ def delete_award_emoji(project, awardable_id, awardable_type, award_id)
116
+ delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji/#{award_id}")
117
+ end
117
118
 
118
- # Deletes a single award emoji from a single note on an awardable(issue, merge request or snippet)
119
- #
120
- # @example
121
- # Gitlab.delete_note_award_emoji(1, 80, 'issue', 1, 4)
122
- # Gitlab.delete_note_award_emoji(1, 60, 'merge_request', 1, 4)
123
- # Gitlab.delete_note_award_emoji(1, 40, 'snippet', 1, 4)
124
- #
125
- # @param [Integer] project The ID of a project.
126
- # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
127
- # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
128
- # @param [Integer] note_id The ID of a note.
129
- # @param [Integer] award_id The ID of an award emoji.
130
- # @return [void] This API call returns an empty response body.
131
- def delete_note_award_emoji(project, awardable_id, awardable_type, note_id, award_id)
132
- delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}")
133
- end
119
+ # Deletes a single award emoji from a single note on an awardable(issue, merge request or snippet)
120
+ #
121
+ # @example
122
+ # Gitlab.delete_note_award_emoji(1, 80, 'issue', 1, 4)
123
+ # Gitlab.delete_note_award_emoji(1, 60, 'merge_request', 1, 4)
124
+ # Gitlab.delete_note_award_emoji(1, 40, 'snippet', 1, 4)
125
+ #
126
+ # @param [Integer] project The ID of a project.
127
+ # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
128
+ # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
129
+ # @param [Integer] note_id The ID of a note.
130
+ # @param [Integer] award_id The ID of an award emoji.
131
+ # @return [void] This API call returns an empty response body.
132
+ def delete_note_award_emoji(project, awardable_id, awardable_type, note_id, award_id)
133
+ delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}")
134
134
  end
135
- end
135
+ end