fs-gitlab 4.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +270 -0
- data/LICENSE.txt +24 -0
- data/README.md +260 -0
- data/exe/gitlab +11 -0
- data/lib/gitlab/api.rb +24 -0
- data/lib/gitlab/cli.rb +89 -0
- data/lib/gitlab/cli_helpers.rb +243 -0
- data/lib/gitlab/client/access_requests.rb +103 -0
- data/lib/gitlab/client/application_settings.rb +172 -0
- data/lib/gitlab/client/avatar.rb +21 -0
- data/lib/gitlab/client/award_emojis.rb +137 -0
- data/lib/gitlab/client/boards.rb +146 -0
- data/lib/gitlab/client/branches.rb +135 -0
- data/lib/gitlab/client/broadcast_messages.rb +75 -0
- data/lib/gitlab/client/build_variables.rb +135 -0
- data/lib/gitlab/client/builds.rb +108 -0
- data/lib/gitlab/client/commits.rb +216 -0
- data/lib/gitlab/client/container_registry.rb +85 -0
- data/lib/gitlab/client/deployments.rb +34 -0
- data/lib/gitlab/client/environments.rb +89 -0
- data/lib/gitlab/client/epic_issues.rb +23 -0
- data/lib/gitlab/client/epics.rb +73 -0
- data/lib/gitlab/client/events.rb +60 -0
- data/lib/gitlab/client/features.rb +48 -0
- data/lib/gitlab/client/group_badges.rb +88 -0
- data/lib/gitlab/client/group_boards.rb +141 -0
- data/lib/gitlab/client/group_labels.rb +88 -0
- data/lib/gitlab/client/group_milestones.rb +94 -0
- data/lib/gitlab/client/groups.rb +358 -0
- data/lib/gitlab/client/issue_links.rb +48 -0
- data/lib/gitlab/client/issues.rb +231 -0
- data/lib/gitlab/client/jobs.rb +250 -0
- data/lib/gitlab/client/keys.rb +29 -0
- data/lib/gitlab/client/labels.rb +88 -0
- data/lib/gitlab/client/lint.rb +19 -0
- data/lib/gitlab/client/markdown.rb +23 -0
- data/lib/gitlab/client/merge_request_approvals.rb +265 -0
- data/lib/gitlab/client/merge_requests.rb +386 -0
- data/lib/gitlab/client/milestones.rb +106 -0
- data/lib/gitlab/client/namespaces.rb +22 -0
- data/lib/gitlab/client/notes.rb +313 -0
- data/lib/gitlab/client/packages.rb +95 -0
- data/lib/gitlab/client/pipeline_schedules.rb +147 -0
- data/lib/gitlab/client/pipeline_triggers.rb +103 -0
- data/lib/gitlab/client/pipelines.rb +105 -0
- data/lib/gitlab/client/project_badges.rb +85 -0
- data/lib/gitlab/client/project_clusters.rb +83 -0
- data/lib/gitlab/client/project_release_links.rb +76 -0
- data/lib/gitlab/client/project_releases.rb +79 -0
- data/lib/gitlab/client/projects.rb +708 -0
- data/lib/gitlab/client/protected_tags.rb +59 -0
- data/lib/gitlab/client/remote_mirrors.rb +51 -0
- data/lib/gitlab/client/repositories.rb +113 -0
- data/lib/gitlab/client/repository_files.rb +131 -0
- data/lib/gitlab/client/repository_submodules.rb +27 -0
- data/lib/gitlab/client/resource_label_events.rb +82 -0
- data/lib/gitlab/client/resource_state_events.rb +57 -0
- data/lib/gitlab/client/runners.rb +211 -0
- data/lib/gitlab/client/search.rb +66 -0
- data/lib/gitlab/client/services.rb +53 -0
- data/lib/gitlab/client/sidekiq.rb +39 -0
- data/lib/gitlab/client/snippets.rb +95 -0
- data/lib/gitlab/client/system_hooks.rb +64 -0
- data/lib/gitlab/client/tags.rb +97 -0
- data/lib/gitlab/client/templates.rb +100 -0
- data/lib/gitlab/client/todos.rb +46 -0
- data/lib/gitlab/client/user_snippets.rb +114 -0
- data/lib/gitlab/client/users.rb +397 -0
- data/lib/gitlab/client/versions.rb +18 -0
- data/lib/gitlab/client/wikis.rb +79 -0
- data/lib/gitlab/client.rb +95 -0
- data/lib/gitlab/configuration.rb +57 -0
- data/lib/gitlab/error.rb +170 -0
- data/lib/gitlab/file_response.rb +48 -0
- data/lib/gitlab/help.rb +94 -0
- data/lib/gitlab/objectified_hash.rb +51 -0
- data/lib/gitlab/page_links.rb +35 -0
- data/lib/gitlab/paginated_response.rb +110 -0
- data/lib/gitlab/request.rb +109 -0
- data/lib/gitlab/shell.rb +83 -0
- data/lib/gitlab/shell_history.rb +57 -0
- data/lib/gitlab/version.rb +5 -0
- data/lib/gitlab.rb +56 -0
- metadata +204 -0
@@ -0,0 +1,137 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to Award Emojis.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/award_emoji.html
|
6
|
+
module AwardEmojis
|
7
|
+
# Gets a list of all award emoji for an awardable(issue, merge request or snippet)
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.award_emojis(1, 80, 'issue')
|
11
|
+
# Gitlab.award_emojis(1, 60, 'merge_request')
|
12
|
+
# Gitlab.award_emojis(1, 40, 'snippet')
|
13
|
+
#
|
14
|
+
# @param [Integer] project The ID of a project.
|
15
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
16
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
17
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
18
|
+
def award_emojis(project, awardable_id, awardable_type)
|
19
|
+
get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji")
|
20
|
+
end
|
21
|
+
|
22
|
+
# Gets a list of all award emoji for a single note on an awardable(issue, merge request or snippet)
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Gitlab.note_award_emojis(1, 80, 'issue', 1)
|
26
|
+
# Gitlab.note_award_emojis(1, 60, 'merge_request', 1)
|
27
|
+
# Gitlab.note_award_emojis(1, 40, 'snippet', 1)
|
28
|
+
#
|
29
|
+
# @param [Integer] project The ID of a project.
|
30
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
31
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
32
|
+
# @param [Integer] note_id The ID of a note.
|
33
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
34
|
+
def note_award_emojis(project, awardable_id, awardable_type, note_id)
|
35
|
+
get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji")
|
36
|
+
end
|
37
|
+
|
38
|
+
# Gets a single award emoji for an awardable(issue, merge request or snippet)
|
39
|
+
#
|
40
|
+
# @example
|
41
|
+
# Gitlab.award_emoji(1, 80, 'issue', 4)
|
42
|
+
# Gitlab.award_emoji(1, 60, 'merge_request', 4)
|
43
|
+
# Gitlab.award_emoji(1, 40, 'snippet', 4)
|
44
|
+
#
|
45
|
+
# @param [Integer] project The ID of a project.
|
46
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
47
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
48
|
+
# @param [Integer] award_id The ID of an award emoji.
|
49
|
+
# @return [Gitlab::ObjectifiedHash]
|
50
|
+
def award_emoji(project, awardable_id, awardable_type, award_id)
|
51
|
+
get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji/#{award_id}")
|
52
|
+
end
|
53
|
+
|
54
|
+
# Gets a single award emoji from a single note on an awardable(issue, merge request or snippet)
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# Gitlab.note_award_emoji(1, 80, 'issue', 1, 4)
|
58
|
+
# Gitlab.note_award_emoji(1, 60, 'merge_request', 1, 4)
|
59
|
+
# Gitlab.note_award_emoji(1, 40, 'snippet', 1, 4)
|
60
|
+
#
|
61
|
+
# @param [Integer] project The ID of a project.
|
62
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
63
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
64
|
+
# @param [Integer] note_id The ID of a note.
|
65
|
+
# @param [Integer] award_id The ID of an award emoji.
|
66
|
+
# @return [Gitlab::ObjectifiedHash]
|
67
|
+
def note_award_emoji(project, awardable_id, awardable_type, note_id, award_id)
|
68
|
+
get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}")
|
69
|
+
end
|
70
|
+
|
71
|
+
# Awards a new emoji to an awardable(issue, merge request or snippet)
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# Gitlab.create_award_emoji(1, 80, 'issue', 'blowfish')
|
75
|
+
# Gitlab.create_award_emoji(1, 80, 'merge_request', 'blowfish')
|
76
|
+
# Gitlab.create_award_emoji(1, 80, 'snippet', 'blowfish')
|
77
|
+
#
|
78
|
+
# @param [Integer] project The ID of a project.
|
79
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
80
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
81
|
+
# @param [String] emoji_name The name of the emoji, without colons.
|
82
|
+
# @return [Gitlab::ObjectifiedHash]
|
83
|
+
def create_award_emoji(project, awardable_id, awardable_type, emoji_name)
|
84
|
+
post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji", body: { name: emoji_name })
|
85
|
+
end
|
86
|
+
|
87
|
+
# Awards a new emoji to a note on an awardable(issue, merge request or snippet)
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# Gitlab.create_note_award_emoji(1, 80, 'issue', 1, 'blowfish')
|
91
|
+
# Gitlab.create_note_award_emoji(1, 80, 'merge_request', 1, 'blowfish')
|
92
|
+
# Gitlab.create_note_award_emoji(1, 80, 'snippet', 1, 'blowfish')
|
93
|
+
#
|
94
|
+
# @param [Integer] project The ID of a project.
|
95
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
96
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
97
|
+
# @param [Integer] note_id The ID of a note.
|
98
|
+
# @param [String] emoji_name The name of the emoji, without colons.
|
99
|
+
# @return [Gitlab::ObjectifiedHash]
|
100
|
+
def create_note_award_emoji(project, awardable_id, awardable_type, note_id, emoji_name)
|
101
|
+
post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji", body: { name: emoji_name })
|
102
|
+
end
|
103
|
+
|
104
|
+
# Deletes a single award emoji from an awardable(issue, merge request or snippet)
|
105
|
+
#
|
106
|
+
# @example
|
107
|
+
# Gitlab.delete_award_emoji(1, 80, 'issue', 4)
|
108
|
+
# Gitlab.delete_award_emoji(1, 60, 'merge_request', 4)
|
109
|
+
# Gitlab.delete_award_emoji(1, 40, 'snippet', 4)
|
110
|
+
#
|
111
|
+
# @param [Integer] project The ID of a project.
|
112
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
113
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
114
|
+
# @param [Integer] award_id The ID of an award emoji.
|
115
|
+
# @return [void] This API call returns an empty response body.
|
116
|
+
def delete_award_emoji(project, awardable_id, awardable_type, award_id)
|
117
|
+
delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji/#{award_id}")
|
118
|
+
end
|
119
|
+
|
120
|
+
# Deletes a single award emoji from a single note on an awardable(issue, merge request or snippet)
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
# Gitlab.delete_note_award_emoji(1, 80, 'issue', 1, 4)
|
124
|
+
# Gitlab.delete_note_award_emoji(1, 60, 'merge_request', 1, 4)
|
125
|
+
# Gitlab.delete_note_award_emoji(1, 40, 'snippet', 1, 4)
|
126
|
+
#
|
127
|
+
# @param [Integer] project The ID of a project.
|
128
|
+
# @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet).
|
129
|
+
# @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet')
|
130
|
+
# @param [Integer] note_id The ID of a note.
|
131
|
+
# @param [Integer] award_id The ID of an award emoji.
|
132
|
+
# @return [void] This API call returns an empty response body.
|
133
|
+
def delete_note_award_emoji(project, awardable_id, awardable_type, note_id, award_id)
|
134
|
+
delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}")
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to issue boards.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/boards.html
|
6
|
+
module Boards
|
7
|
+
# Gets a list of project's boards.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.boards(5)
|
11
|
+
# Gitlab.boards({ per_page: 40 })
|
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 [Integer] :page The page number.
|
16
|
+
# @option options [Integer] :per_page The number of results per page.
|
17
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
18
|
+
def boards(project, options = {})
|
19
|
+
get("/projects/#{url_encode project}/boards", query: options)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Get a single board.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Gitlab.board(5, 1)
|
26
|
+
#
|
27
|
+
# @param [Integer, String] project The ID or name of a project.
|
28
|
+
# @param [Integer] id The ID of a board.
|
29
|
+
# @return [Gitlab::ObjectifiedHash] Returns information about the board
|
30
|
+
def board(project, id)
|
31
|
+
get("/projects/#{url_encode project}/boards/#{id}")
|
32
|
+
end
|
33
|
+
|
34
|
+
# Creates a new board.
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# Gitlab.create_board(5, 'newboard')
|
38
|
+
#
|
39
|
+
# @param [Integer, String] project The ID or name of a project.
|
40
|
+
# @param [String] name The name of the new board.
|
41
|
+
# @return [Gitlab::ObjectifiedHash] Information about created board.
|
42
|
+
def create_board(project, name)
|
43
|
+
body = { name: name }
|
44
|
+
post("/projects/#{url_encode project}/boards", body: body)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Updates a board.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# Gitlab.edit_board(5, 1, name: 'new_name')
|
51
|
+
# Gitlab.edit_board(5, 1, name: 'new_name', assignee_id: 1, milestone_id: 1)
|
52
|
+
#
|
53
|
+
# @param [Integer, String] project The ID or name of a project.
|
54
|
+
# @param [Integer] id The ID of a board.
|
55
|
+
# @param [Hash] options A customizable set of options.
|
56
|
+
# @option options [String] :name(optional) The new name of the board.
|
57
|
+
# @option options [Integer] :assignee_id(optional) The assignee the board should be scoped to.
|
58
|
+
# @option options [Integer] :milestone_id(optional) The milestone the board should be scoped to.
|
59
|
+
# @option options [String] :labels(optional) Comma-separated list of label names which the board should be scoped to.
|
60
|
+
# @option options [Integer] :weight(optional) The weight range from 0 to 9, to which the board should be scoped to.
|
61
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated board.
|
62
|
+
def edit_board(project, id, options = {})
|
63
|
+
put("/projects/#{url_encode project}/boards/#{id}", body: options)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Deletes a board.
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# Gitlab.delete_board(5, 1)
|
70
|
+
#
|
71
|
+
# @param [Integer, String] project The ID or name of a project.
|
72
|
+
# @param [Integer] id The ID of a board.
|
73
|
+
# @return [void] This API call returns an empty response body.
|
74
|
+
def delete_board(project, id)
|
75
|
+
delete("/projects/#{url_encode project}/boards/#{id}")
|
76
|
+
end
|
77
|
+
|
78
|
+
# Gets a board lists
|
79
|
+
#
|
80
|
+
# @example
|
81
|
+
# Gitlab.board_lists(5, 42)
|
82
|
+
#
|
83
|
+
# @param [Integer, String] project The ID or name of a project.
|
84
|
+
# @param [Integer] id The ID of a board.
|
85
|
+
# @return [Gitlab::ObjectifiedHash]
|
86
|
+
def board_lists(project, id)
|
87
|
+
get("/projects/#{url_encode project}/boards/#{id}/lists")
|
88
|
+
end
|
89
|
+
|
90
|
+
#
|
91
|
+
# Gets a single board list
|
92
|
+
#
|
93
|
+
# @example
|
94
|
+
# Gitlab.board_list(5, 42, 25)
|
95
|
+
#
|
96
|
+
# @param [Integer, String] project The ID or name of a project.
|
97
|
+
# @param [Integer] board_id The ID of a board.
|
98
|
+
# @param [Integer] id The ID of a list.
|
99
|
+
# @return [Gitlab::ObjectifiedHash]
|
100
|
+
def board_list(project, board_id, id)
|
101
|
+
get("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}")
|
102
|
+
end
|
103
|
+
|
104
|
+
# Creates a new board list.
|
105
|
+
# Only for admins and project owners
|
106
|
+
#
|
107
|
+
# @example
|
108
|
+
# Gitlab.create_board_list(5, 42, 25)
|
109
|
+
#
|
110
|
+
# @param [Integer, String] project The ID or name of a project.
|
111
|
+
# @param [Integer] id The ID of a board.
|
112
|
+
# @param [Integer] label_id The ID of a label.
|
113
|
+
# @return [Gitlab::ObjectifiedHash] Information about created list.
|
114
|
+
def create_board_list(project, board_id, label_id)
|
115
|
+
post("/projects/#{url_encode project}/boards/#{board_id}/lists", body: { label_id: label_id })
|
116
|
+
end
|
117
|
+
|
118
|
+
# Updates a board list.
|
119
|
+
# Only for admins and project owners
|
120
|
+
#
|
121
|
+
# @example
|
122
|
+
# Gitlab.edit_board_list(6, 1, 12, 5)
|
123
|
+
#
|
124
|
+
# @param [Integer, String] project The ID or name of a project.
|
125
|
+
# @param [Integer] board_id The ID of a board.
|
126
|
+
# @param [Integer] id The ID of a list.
|
127
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated board list.
|
128
|
+
def edit_board_list(project, board_id, id, position)
|
129
|
+
put("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}", body: { position: position })
|
130
|
+
end
|
131
|
+
|
132
|
+
# Deletes a board list.
|
133
|
+
# Only for admins and project owners
|
134
|
+
#
|
135
|
+
# @example
|
136
|
+
# Gitlab.delete_board_list(3, 42, 32)
|
137
|
+
#
|
138
|
+
# @param [Integer, String] project The ID or name of a project.
|
139
|
+
# @param [Integer] board_id The ID of a board.
|
140
|
+
# @param [Integer] id The ID of a list.
|
141
|
+
# @return [Gitlab::ObjectifiedHash] Information about deleted board list.
|
142
|
+
def delete_board_list(project, board_id, id)
|
143
|
+
delete("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to repositories.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/branches.html
|
6
|
+
module Branches
|
7
|
+
# Gets a list of project repositiory branches.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.branches(42)
|
11
|
+
#
|
12
|
+
# @param [Integer, String] project The ID or name of a project.
|
13
|
+
# @param [Hash] options A customizable set of options.
|
14
|
+
# @option options [Integer] :page The page number.
|
15
|
+
# @option options [Integer] :per_page The number of results per page.
|
16
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
17
|
+
def branches(project, options = {})
|
18
|
+
get("/projects/#{url_encode project}/repository/branches", query: options)
|
19
|
+
end
|
20
|
+
alias repo_branches branches
|
21
|
+
|
22
|
+
# Gets information about a repository branch.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Gitlab.branch(3, 'api')
|
26
|
+
# Gitlab.repo_branch(5, 'master')
|
27
|
+
#
|
28
|
+
# @param [Integer, String] project The ID or name of a project.
|
29
|
+
# @param [String] branch The name of the branch.
|
30
|
+
# @return [Gitlab::ObjectifiedHash]
|
31
|
+
def branch(project, branch)
|
32
|
+
get("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
|
33
|
+
end
|
34
|
+
alias repo_branch branch
|
35
|
+
|
36
|
+
# Protects a repository branch.
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# Gitlab.protect_branch(3, 'api')
|
40
|
+
# Gitlab.repo_protect_branch(5, 'master')
|
41
|
+
# Gitlab.protect_branch(5, 'api', developers_can_push: true)
|
42
|
+
#
|
43
|
+
# To update options, call `protect_branch` again with new options (i.e. `developers_can_push: false`)
|
44
|
+
#
|
45
|
+
# @param [Integer, String] project The ID or name of a project.
|
46
|
+
# @param [String] branch The name of the branch.
|
47
|
+
# @param [Hash] options A customizable set of options.
|
48
|
+
# @option options [Boolean] :developers_can_push True to allow developers to push to the branch (default = false)
|
49
|
+
# @option options [Boolean] :developers_can_merge True to allow developers to merge into the branch (default = false)
|
50
|
+
# @return [Gitlab::ObjectifiedHash] Details about the branch
|
51
|
+
def protect_branch(project, branch, options = {})
|
52
|
+
post("/projects/#{url_encode project}/protected_branches", body: { name: branch }.merge(options))
|
53
|
+
end
|
54
|
+
alias repo_protect_branch protect_branch
|
55
|
+
|
56
|
+
# Unprotects a repository branch.
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
# Gitlab.unprotect_branch(3, 'api')
|
60
|
+
# Gitlab.repo_unprotect_branch(5, 'master')
|
61
|
+
#
|
62
|
+
# @param [Integer, String] project The ID or name of a project.
|
63
|
+
# @param [String] branch The name of the branch.
|
64
|
+
# @return [Gitlab::ObjectifiedHash] Details about the branch
|
65
|
+
def unprotect_branch(project, branch)
|
66
|
+
delete("/projects/#{url_encode project}/protected_branches/#{url_encode branch}")
|
67
|
+
end
|
68
|
+
alias repo_unprotect_branch unprotect_branch
|
69
|
+
|
70
|
+
# Creates a repository branch. Requires Gitlab >= 6.8.x
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# Gitlab.create_branch(3, 'api', 'feat/new-api')
|
74
|
+
# Gitlab.repo_create_branch(5, 'master', 'develop')
|
75
|
+
#
|
76
|
+
# @param [Integer, String] project The ID or name of a project.
|
77
|
+
# @param [String] branch The name of the new branch.
|
78
|
+
# @param [String] ref Create branch from commit sha or existing branch
|
79
|
+
# @return [Gitlab::ObjectifiedHash] Details about the branch
|
80
|
+
def create_branch(project, branch, ref)
|
81
|
+
post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref })
|
82
|
+
end
|
83
|
+
alias repo_create_branch create_branch
|
84
|
+
|
85
|
+
# Deletes a repository branch. Requires Gitlab >= 6.8.x
|
86
|
+
#
|
87
|
+
# @example
|
88
|
+
# Gitlab.delete_branch(3, 'api')
|
89
|
+
# Gitlab.repo_delete_branch(5, 'master')
|
90
|
+
#
|
91
|
+
# @param [Integer, String] project The ID or name of a project.
|
92
|
+
# @param [String] branch The name of the branch to delete
|
93
|
+
def delete_branch(project, branch)
|
94
|
+
delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}")
|
95
|
+
end
|
96
|
+
alias repo_delete_branch delete_branch
|
97
|
+
|
98
|
+
# Delete all branches that are merged into the project default branch. Protected branches will not be deleted as part of this operation.
|
99
|
+
#
|
100
|
+
# @example
|
101
|
+
# Gitlab.delete_merged_branches(3)
|
102
|
+
#
|
103
|
+
# @param [Integer, String] project The ID or name of a project.
|
104
|
+
# @return [nil] This API call returns an empty response body.
|
105
|
+
def delete_merged_branches(project)
|
106
|
+
delete("/projects/#{url_encode project}/repository/merged_branches")
|
107
|
+
end
|
108
|
+
alias repo_delete_merged_branches delete_merged_branches
|
109
|
+
|
110
|
+
# Gets a list of protected branches from a project.
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
# Gitlab.protected_branches(42)
|
114
|
+
#
|
115
|
+
# @param [Integer, String] project The ID or name of a project.
|
116
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
117
|
+
def protected_branches(project)
|
118
|
+
get("/projects/#{url_encode project}/protected_branches")
|
119
|
+
end
|
120
|
+
alias repo_protected_branches protected_branches
|
121
|
+
|
122
|
+
# Gets a single protected branch or wildcard protected branch
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
# Gitlab.protected_branch(3, 'api')
|
126
|
+
#
|
127
|
+
# @param [Integer, String] project The ID or name of a project.
|
128
|
+
# @param [String] name The name of the branch or wildcard
|
129
|
+
# @return [Gitlab::ObjectifiedHash]
|
130
|
+
def protected_branch(project, branch)
|
131
|
+
get("/projects/#{url_encode project}/protected_branches/#{url_encode branch}")
|
132
|
+
end
|
133
|
+
alias repo_protected_branch protected_branch
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to broadcast messages (only accessible to administrators).
|
5
|
+
# @see https://docs.gitlab.com/ce/api/broadcast_messages.html
|
6
|
+
module BroadcastMessages
|
7
|
+
# Get all broadcast messages
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# Gitlab.broadcast_messages
|
11
|
+
#
|
12
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
13
|
+
def broadcast_messages
|
14
|
+
get('/broadcast_messages')
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a specific broadcast message
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# Gitlab.broadcast_message(3)
|
21
|
+
#
|
22
|
+
# @param [Integer] id The ID of broadcast message
|
23
|
+
# @return [Gitlab::ObjectifiedHash]
|
24
|
+
def broadcast_message(id)
|
25
|
+
get("/broadcast_messages/#{id}")
|
26
|
+
end
|
27
|
+
|
28
|
+
# Create a broadcast message.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# Gitlab.create_broadcast_message('Mayday')
|
32
|
+
# Gitlab.create_broadcast_message('Mayday', {starts_at: Time.zone.now, ends_at: Time.zone.now + 30.minutes, color: '#cecece', font: '#FFFFFF'})
|
33
|
+
#
|
34
|
+
# @param [String] message Message to display
|
35
|
+
# @param [Hash] options A customizable set of options.
|
36
|
+
# @option options [DateTime] :starts_at(optional) Starting time (defaults to current time)
|
37
|
+
# @option options [DateTime] :ends_at(optional) Ending time (defaults to one hour from current time)
|
38
|
+
# @option options [String] :color(optional) Background color hex code
|
39
|
+
# @option options [String] :font(optional) Foreground color hex code
|
40
|
+
# @return [Gitlab::ObjectifiedHash] Information about created broadcast message.
|
41
|
+
def create_broadcast_message(message, options = {})
|
42
|
+
body = { message: message }.merge(options)
|
43
|
+
post('/broadcast_messages', body: body)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Update a broadcast message
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# Gitlab.edit_broadcast_message(6, { message: 'No Mayday' })
|
50
|
+
# Gitlab.edit_broadcast_message(6, { font: '#FEFEFE' })
|
51
|
+
#
|
52
|
+
# @param [Integer] id The ID of a broadcast message
|
53
|
+
# @param [Hash] options A customizable set of options.
|
54
|
+
# @option options [String] :message(optional) Message to display
|
55
|
+
# @option options [DateTime] :starts_at(optional) Starting time (defaults to current time)
|
56
|
+
# @option options [DateTime] :ends_at(optional) Ending time (defaults to one hour from current time)
|
57
|
+
# @option options [String] :color(optional) Background color hex code
|
58
|
+
# @option options [String] :font(optional) Foreground color hex code
|
59
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated broadcast message.
|
60
|
+
def edit_broadcast_message(id, options = {})
|
61
|
+
put("/broadcast_messages/#{id}", body: options)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Delete a broadcast message.
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# Gitlab.delete_broadcast_message(3)
|
68
|
+
#
|
69
|
+
# @param [Integer] id The ID of a broadcast message.
|
70
|
+
# @return [nil] This API call returns an empty response body.
|
71
|
+
def delete_broadcast_message(id)
|
72
|
+
delete("/broadcast_messages/#{id}")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gitlab::Client
|
4
|
+
# Defines methods related to builds.
|
5
|
+
# @see https://docs.gitlab.com/ce/api/project_level_variables.html
|
6
|
+
# @see https://docs.gitlab.com/ce/api/group_level_variables.html
|
7
|
+
module BuildVariables
|
8
|
+
# Gets a list of the project's build variables
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# Gitlab.variables(5)
|
12
|
+
#
|
13
|
+
# @param [Integer, String] project The ID or name of a project.
|
14
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The list of variables.
|
15
|
+
def variables(project)
|
16
|
+
get("/projects/#{url_encode project}/variables")
|
17
|
+
end
|
18
|
+
|
19
|
+
# Gets details of a project's specific build variable.
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# Gitlab.variable(5, "TEST_VARIABLE_1")
|
23
|
+
#
|
24
|
+
# @param [Integer, String] project The ID or name of a project.
|
25
|
+
# @param [String] key The key of a variable.
|
26
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
27
|
+
def variable(project, key)
|
28
|
+
get("/projects/#{url_encode project}/variables/#{key}")
|
29
|
+
end
|
30
|
+
|
31
|
+
# Create a build variable for a project.
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# Gitlab.create_variable(5, "NEW_VARIABLE", "new value")
|
35
|
+
#
|
36
|
+
# @param [Integer, String] project The ID or name of a project.
|
37
|
+
# @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed
|
38
|
+
# @param [String] value The value of a variable
|
39
|
+
# @param [Hash] opts optional parameters
|
40
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
41
|
+
def create_variable(project, key, value, **opts)
|
42
|
+
post("/projects/#{url_encode project}/variables", body: opts.merge(key: key, value: value))
|
43
|
+
end
|
44
|
+
|
45
|
+
# Update a project's build variable.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# Gitlab.update_variable(5, "NEW_VARIABLE", "updated value")
|
49
|
+
#
|
50
|
+
# @param [Integer, String] project The ID or name of a project.
|
51
|
+
# @param [String] key The key of a variable
|
52
|
+
# @param [String] value The value of a variable
|
53
|
+
# @param [Hash] opts optional parameters
|
54
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
55
|
+
def update_variable(project, key, value, **opts)
|
56
|
+
put("/projects/#{url_encode project}/variables/#{key}", body: opts.merge(value: value))
|
57
|
+
end
|
58
|
+
|
59
|
+
# Remove a project's build variable.
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
# Gitlab.remove_variable(5, "VARIABLE_1")
|
63
|
+
#
|
64
|
+
# @param [Integer, String] project The ID or name of a project.
|
65
|
+
# @param [String] key The key of a variable.
|
66
|
+
# @param [Hash] opts optional parameters
|
67
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
68
|
+
def remove_variable(project, key, **opts)
|
69
|
+
delete("/projects/#{url_encode project}/variables/#{key}", query: opts)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Gets a list of the group's build variables
|
73
|
+
#
|
74
|
+
# @example
|
75
|
+
# Gitlab.group_variables(5)
|
76
|
+
#
|
77
|
+
# @param [Integer, String] group The ID or name of a group.
|
78
|
+
# @return [Array<Gitlab::ObjectifiedHash>] The list of variables.
|
79
|
+
def group_variables(group)
|
80
|
+
get("/groups/#{url_encode group}/variables")
|
81
|
+
end
|
82
|
+
|
83
|
+
# Gets details of a group's specific build variable.
|
84
|
+
#
|
85
|
+
# @example
|
86
|
+
# Gitlab.group_variable(5, "TEST_VARIABLE_1")
|
87
|
+
#
|
88
|
+
# @param [Integer, String] group The ID or name of a group.
|
89
|
+
# @param [String] key The key of a variable.
|
90
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
91
|
+
def group_variable(group, key)
|
92
|
+
get("/groups/#{url_encode group}/variables/#{key}")
|
93
|
+
end
|
94
|
+
|
95
|
+
# Create a build variable for a group.
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
# Gitlab.create_group_variable(5, "NEW_VARIABLE", "new value")
|
99
|
+
#
|
100
|
+
# @param [Integer, String] group The ID or name of a group.
|
101
|
+
# @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed
|
102
|
+
# @param [String] value The value of a variable
|
103
|
+
# @param [Hash] opts optional parameters
|
104
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
105
|
+
def create_group_variable(group, key, value, **opts)
|
106
|
+
post("/groups/#{url_encode group}/variables", body: opts.merge(key: key, value: value))
|
107
|
+
end
|
108
|
+
|
109
|
+
# Update a group's build variable.
|
110
|
+
#
|
111
|
+
# @example
|
112
|
+
# Gitlab.update_group_variable(5, "NEW_VARIABLE", "updated value")
|
113
|
+
#
|
114
|
+
# @param [Integer, String] group The ID or name of a group.
|
115
|
+
# @param [String] key The key of a variable
|
116
|
+
# @param [String] value The value of a variable
|
117
|
+
# @param [Hash] opts optional parameters
|
118
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
119
|
+
def update_group_variable(group, key, value, **opts)
|
120
|
+
put("/groups/#{url_encode group}/variables/#{key}", body: opts.merge(value: value))
|
121
|
+
end
|
122
|
+
|
123
|
+
# Remove a group's build variable.
|
124
|
+
#
|
125
|
+
# @example
|
126
|
+
# Gitlab.remove_group_variable(5, "VARIABLE_1")
|
127
|
+
#
|
128
|
+
# @param [Integer, String] group The ID or name of a group.
|
129
|
+
# @param [String] key The key of a variable.
|
130
|
+
# @return [Gitlab::ObjectifiedHash] The variable.
|
131
|
+
def remove_group_variable(group, key)
|
132
|
+
delete("/groups/#{url_encode group}/variables/#{key}")
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|