Update upstream source from tag 'upstream/4.5.0'
Update to upstream version '4.5.0'
with Debian dir 394f0988dbff44ce1c33ef94949f7225423268a4
Cédric Boutillier
4 years ago
0 | language: ruby | |
1 | rvm: | |
2 | - 2.0 | |
3 | - 2.1 | |
4 | - 2.2 | |
5 | - 2.3 | |
6 | - 2.4.0 | |
7 | before_install: gem update bundler |
0 | ## Change Log | |
1 | ||
2 | ### Unreleased | |
0 | ## CHANGELOG | |
1 | ||
2 | ### Newer releases | |
3 | ||
4 | Please see: https://github.com/NARKOZ/gitlab/releases | |
3 | 5 | |
4 | 6 | ### 4.2.0 (13/07/2017) |
5 | 7 | - Use `url_encode` in all `Commit` resources (@grodowski) |
0 | 0 | # Gitlab |
1 | 1 | |
2 | [](https://travis-ci.org/NARKOZ/gitlab) | |
3 | [](https://codeclimate.com/github/NARKOZ/gitlab) | |
4 | [](https://inch-ci.org/github/NARKOZ/gitlab) | |
5 | [](https://rubygems.org/gems/gitlab) | |
6 | [](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt) | |
2 | [](https://travis-ci.org/NARKOZ/gitlab) | |
3 | [](https://codeclimate.com/github/NARKOZ/gitlab) | |
4 | [](https://inch-ci.org/github/NARKOZ/gitlab) | |
5 | [](https://rubygems.org/gems/gitlab) | |
6 | [](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt) | |
7 | 7 | |
8 | 8 | [website](http://narkoz.github.io/gitlab) | |
9 | 9 | [documentation](http://rubydoc.info/gems/gitlab/frames) | |
10 | 10 | [gitlab-live](https://github.com/NARKOZ/gitlab-live) |
11 | 11 | |
12 | Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ce/api/README.html). | |
13 | As of version `4.0.0` this gem will only support Ruby 2.0+ and Gitlab API v4. | |
12 | Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ce/api/README.html). | |
13 | As of version `4.0.0` this gem only supports Ruby 2.0+ and Gitlab API v4. | |
14 | 14 | |
15 | 15 | ## Installation |
16 | 16 | |
25 | 25 | ```ruby |
26 | 26 | gem 'gitlab' |
27 | 27 | # gem 'gitlab', github: 'NARKOZ/gitlab' |
28 | ``` | |
29 | ||
30 | Mac OS users can install using Homebrew: | |
31 | ||
32 | ```sh | |
33 | brew install gitlab-gem | |
28 | 34 | ``` |
29 | 35 | |
30 | 36 | ## Usage |
174 | 180 | |
175 | 181 | ## Development |
176 | 182 | |
183 | ### With a dockerized Gitlab instance | |
184 | ||
185 | ```shell | |
186 | docker-compose up -d gitlab # Will start the gitlab instance in the background (approx. 3 minutes) | |
187 | ``` | |
188 | ||
189 | After a while, your Gitlab instance will be accessible on http://localhost:3000. | |
190 | ||
191 | Once you have set your new root password, you can login with the root user. | |
192 | ||
193 | You can now setup a personal access token here: http://localhost:3000/profile/personal_access_tokens | |
194 | ||
195 | Once you have your token, set the variables to the correct values in the `docker.env` file. | |
196 | ||
197 | Then, launch the tool: | |
198 | ||
199 | ```shell | |
200 | docker-compose run app | |
201 | ``` | |
202 | ||
203 | ```ruby | |
204 | Gitlab.users | |
205 | => [#<Gitlab::ObjectifiedHash:47231290771040 {hash: {"id"=>1, "name"=>"Administrator", "username"=>"root", ...] | |
206 | ``` | |
207 | ||
208 | To launch the specs, | |
209 | ||
210 | ```shell | |
211 | docker-compose run app rake spec | |
212 | ``` | |
213 | ||
214 | #### Want to use Gitlab Enterprise? | |
215 | ||
216 | Just change the image from `gitlab/gitlab-ce:latest` to `gitlab/gitlab-ee:latest` in the `docker-compose.yml` file. | |
217 | ||
218 | ### With an external Gitlab instance | |
219 | ||
220 | First, set the variables to the correct values in the `docker.env` file. | |
221 | ||
222 | Then, launch the tool: | |
223 | ||
224 | ```shell | |
225 | docker-compose run app | |
226 | ``` | |
227 | ||
228 | ```ruby | |
229 | Gitlab.users | |
230 | => [#<Gitlab::ObjectifiedHash:47231290771040 {hash: {"id"=>1, "name"=>"Administrator", "username"=>"root", ...] | |
231 | ``` | |
232 | ||
233 | To launch the specs, | |
234 | ||
235 | ```shell | |
236 | docker-compose run app rake spec | |
237 | ``` | |
238 | ||
239 | ### Without Docker | |
240 | ||
177 | 241 | After checking out the repo, run `bin/setup` to install dependencies. Then, run |
178 | 242 | `rake spec` to run the tests. You can also run `bin/console` for an interactive |
179 | 243 | prompt that will allow you to experiment. |
0 | require "bundler/gem_tasks" | |
0 | require 'bundler/gem_tasks' | |
1 | 1 | |
2 | 2 | require 'rspec/core/rake_task' |
3 | 3 | RSpec::Core::RakeTask.new(:spec) do |spec| |
4 | spec.pattern = FileList['spec/**/*_spec.rb'] | |
5 | 4 | spec.rspec_opts = ['--color', '--format d'] |
6 | 5 | end |
7 | 6 | |
8 | task default: :spec | |
7 | require 'rubocop/rake_task' | |
8 | RuboCop::RakeTask.new(:rubocop) do |task| | |
9 | task.options = ['-D', '--parallel'] | |
10 | end | |
11 | ||
12 | if ENV['TRAVIS_CI_RUBOCOP'] | |
13 | task default: :rubocop | |
14 | else | |
15 | task default: :spec | |
16 | end |
0 | # -*- encoding: utf-8 -*- | |
1 | 0 | lib = File.expand_path('../lib', __FILE__) |
2 | 1 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) |
3 | 2 | require 'gitlab/version' |
4 | 3 | |
5 | 4 | Gem::Specification.new do |gem| |
6 | gem.name = "gitlab" | |
5 | gem.name = 'gitlab' | |
7 | 6 | gem.version = Gitlab::VERSION |
8 | gem.authors = ["Nihad Abbasov"] | |
9 | gem.email = ["mail@narkoz.me"] | |
10 | gem.description = %q{Ruby client and CLI for GitLab API} | |
11 | gem.summary = %q{A Ruby wrapper and CLI for the GitLab API} | |
12 | gem.homepage = "https://github.com/narkoz/gitlab" | |
7 | gem.authors = ['Nihad Abbasov', 'Sean Edge'] | |
8 | gem.email = ['mail@narkoz.me', 'asedge@gmail.com'] | |
9 | gem.description = 'Ruby client and CLI for GitLab API' | |
10 | gem.summary = 'A Ruby wrapper and CLI for the GitLab API' | |
11 | gem.homepage = 'https://github.com/narkoz/gitlab' | |
13 | 12 | |
14 | gem.files = `git ls-files`.split($/) | |
15 | gem.bindir = "exe" | |
13 | gem.files = `git ls-files`.split($/). | |
14 | reject { |f| f[/^spec/] } - | |
15 | %w[Dockerfile docker-compose.yml docker.env .travis.yml .rubocop.yml .dockerignore] | |
16 | gem.bindir = 'exe' | |
16 | 17 | gem.executables = gem.files.grep(%r{^exe/}) { |f| File.basename(f) } |
17 | 18 | gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) |
18 | gem.require_paths = ["lib"] | |
19 | gem.license = "BSD" | |
19 | gem.require_paths = ['lib'] | |
20 | gem.license = 'BSD' | |
20 | 21 | |
21 | gem.required_ruby_version = ">= 2.0.0" | |
22 | gem.required_ruby_version = '>= 2.0.0' | |
22 | 23 | |
23 | gem.add_runtime_dependency 'httparty' | |
24 | gem.add_runtime_dependency 'terminal-table' | |
24 | gem.add_runtime_dependency 'httparty', '>= 0.14.0' | |
25 | gem.add_runtime_dependency 'terminal-table', '>= 1.5.1' | |
25 | 26 | |
26 | 27 | gem.add_development_dependency 'pry' |
27 | 28 | gem.add_development_dependency 'rake' |
28 | 29 | gem.add_development_dependency 'rspec' |
29 | 30 | gem.add_development_dependency 'webmock' |
31 | gem.add_development_dependency 'rubocop' | |
30 | 32 | end |
12 | 12 | (Configuration::VALID_OPTIONS_KEYS + [:auth_token]).each do |key| |
13 | 13 | send("#{key}=", options[key]) if options[key] |
14 | 14 | end |
15 | set_request_defaults(@sudo) | |
15 | request_defaults(@sudo) | |
16 | self.class.headers 'User-Agent' => user_agent | |
16 | 17 | end |
17 | 18 | end |
18 | 19 | end |
51 | 51 | end |
52 | 52 | |
53 | 53 | unless valid_command?(cmd) |
54 | puts "Unknown command. Run `gitlab help` for a list of available commands." | |
54 | puts 'Unknown command. Run `gitlab help` for a list of available commands.' | |
55 | 55 | exit(1) |
56 | 56 | end |
57 | 57 | |
58 | if args.any? && (args.last.start_with?('--only=') || args.last.start_with?('--except=')) | |
59 | command_args = args[0..-2] | |
60 | else | |
61 | command_args = args | |
62 | end | |
58 | command_args = args.any? && args.last.start_with?('--only=', '--except=') ? args[0..-2] : args | |
63 | 59 | |
64 | 60 | begin |
65 | 61 | command_args.map! { |arg| symbolize_keys(yaml_load(arg)) } |
66 | 66 | # |
67 | 67 | # @return [String] |
68 | 68 | def confirm_command(cmd) |
69 | if cmd.start_with?('remove_') || cmd.start_with?('delete_') | |
70 | puts "Are you sure? (y/n)" | |
71 | if %w(y yes).include?($stdin.gets.to_s.strip.downcase) | |
72 | puts 'Proceeding..' | |
73 | else | |
74 | puts 'Command aborted.' | |
75 | exit(1) | |
76 | end | |
69 | return unless cmd.start_with?('remove_', 'delete_') | |
70 | ||
71 | puts 'Are you sure? (y/n)' | |
72 | ||
73 | if %w(y yes).include?($stdin.gets.to_s.strip.downcase) | |
74 | puts 'Proceeding..' | |
75 | else | |
76 | puts 'Command aborted.' | |
77 | exit(1) | |
77 | 78 | end |
78 | 79 | end |
79 | 80 | |
101 | 102 | end |
102 | 103 | |
103 | 104 | def output_json(cmd, args, data) |
104 | if data.empty? | |
105 | if data.respond_to?(:empty?) && data.empty? | |
105 | 106 | puts '{}' |
106 | 107 | else |
107 | 108 | hash_result = case data |
108 | when Gitlab::ObjectifiedHash,Gitlab::FileResponse | |
109 | when Gitlab::ObjectifiedHash, Gitlab::FileResponse | |
109 | 110 | record_hash([data], cmd, args, true) |
110 | 111 | when Gitlab::PaginatedResponse |
111 | 112 | record_hash(data, cmd, args) |
112 | 113 | else |
113 | 114 | { cmd: cmd, data: data, args: args } |
114 | end | |
115 | end | |
115 | 116 | puts JSON.pretty_generate(hash_result) |
116 | 117 | end |
117 | 118 | end |
134 | 135 | keys.each do |key| |
135 | 136 | case value = hash[key] |
136 | 137 | when Hash |
137 | value = value.has_key?('id') ? value['id'] : 'Hash' | |
138 | value = value.key?('id') ? value['id'] : 'Hash' | |
138 | 139 | when StringIO |
139 | 140 | value = 'File' |
140 | 141 | when nil |
193 | 194 | # Helper function to get rows and keys from data returned from API call |
194 | 195 | def get_keys(args, data) |
195 | 196 | arr = data.map(&:to_h) |
196 | keys = arr.first.keys.sort { |x, y| x.to_s <=> y.to_s } | |
197 | keys = arr.first.keys.sort_by(&:to_s) | |
197 | 198 | keys &= required_fields(args) if required_fields(args).any? |
198 | 199 | keys -= excluded_fields(args) |
199 | 200 | [arr, keys] |
219 | 220 | begin |
220 | 221 | newhash[key.to_sym] = symbolize_keys(value) |
221 | 222 | rescue NoMethodError |
222 | raise "error: cannot convert hash key to symbol: #{key}" | |
223 | raise "Error: cannot convert hash key to symbol: #{key}" | |
223 | 224 | end |
224 | 225 | end |
225 | 226 | end |
229 | 230 | |
230 | 231 | # YAML::load on a single argument |
231 | 232 | def yaml_load(arg) |
232 | begin | |
233 | yaml = YAML.load(arg) | |
234 | rescue Psych::SyntaxError | |
235 | raise "error: Argument is not valid YAML syntax: #{arg}" | |
236 | end | |
237 | yaml | |
233 | YAML.safe_load(arg) | |
234 | rescue Psych::SyntaxError | |
235 | raise "Error: Argument is not valid YAML syntax: #{arg}" | |
238 | 236 | end |
239 | 237 | end |
240 | 238 | end |
0 | class Gitlab::Client | |
1 | # Defines methods related to Award Emojis. | |
2 | # @see https://docs.gitlab.com/ce/api/access_requests.html | |
3 | module AccessRequests | |
4 | # Gets a list of access requests for a project viewable by the authenticated user. | |
5 | # | |
6 | # @example | |
7 | # Gitlab.project_access_requests(1) | |
8 | # | |
9 | # @param [Integer, String] :project(required) The ID or name of a project. | |
10 | # @return [Array<Gitlab::ObjectifiedHash>] List of project access requests | |
11 | def project_access_requests(project) | |
12 | get("/projects/#{url_encode project}/access_requests") | |
13 | end | |
14 | # Gets a list of access requests for a group viewable by the authenticated user. | |
15 | # | |
16 | # @example | |
17 | # Gitlab.group_access_requests(1) | |
18 | # | |
19 | # @param [Integer, String] :group(required) The ID or name of a group. | |
20 | # @return [Array<Gitlab::ObjectifiedHash>] List of group access requests | |
21 | def group_access_requests(group) | |
22 | get("/groups/#{url_encode group}/access_requests") | |
23 | end | |
24 | # Requests access for the authenticated user to a project. | |
25 | # | |
26 | # @example | |
27 | # Gitlab.request_project_access(1) | |
28 | # | |
29 | # @param [Integer, String] :project(required) The ID or name of a project. | |
30 | # @return <Gitlab::ObjectifiedHash] Information about the requested project access | |
31 | def request_project_access(project) | |
32 | post("/projects/#{url_encode project}/access_requests") | |
33 | end | |
34 | # Requests access for the authenticated user to a group. | |
35 | # | |
36 | # @example | |
37 | # Gitlab.request_group_access(1) | |
38 | # | |
39 | # @param [Integer, String] :group(required) The ID or name of a group. | |
40 | # @return <Gitlab::ObjectifiedHash] Information about the requested group access | |
41 | def request_group_access(group) | |
42 | post("/groups/#{url_encode group}/access_requests") | |
43 | end | |
44 | # Approves a project access request for the given user. | |
45 | # | |
46 | # @example | |
47 | # Gitlab.approve_project_access_request(1, 1) | |
48 | # Gitlab.approve_project_access_request(1, 1, {access_level: '30'}) | |
49 | # | |
50 | # @param [Integer, String] :project(required) The ID or name of a project. | |
51 | # @param [Integer] :user_id(required) The user ID of the access requester | |
52 | # @option options [Integer] :access_level(optional) A valid access level (defaults: 30, developer access level) | |
53 | # @return <Gitlab::ObjectifiedHash] Information about the approved project access request | |
54 | def approve_project_access_request(project, user_id, options = {}) | |
55 | put("/projects/#{url_encode project}/access_requests/#{user_id}/approve", body: options) | |
56 | end | |
57 | # Approves a group access request for the given user. | |
58 | # | |
59 | # @example | |
60 | # Gitlab.approve_group_access_request(1, 1) | |
61 | # Gitlab.approve_group_access_request(1, 1, {access_level: '30'}) | |
62 | # | |
63 | # @param [Integer, String] :group(required) The ID or name of a group. | |
64 | # @param [Integer] :user_id(required) The user ID of the access requester | |
65 | # @option options [Integer] :access_level(optional) A valid access level (defaults: 30, developer access level) | |
66 | # @return <Gitlab::ObjectifiedHash] Information about the approved group access request | |
67 | def approve_group_access_request(group, user_id, options = {}) | |
68 | put("/groups/#{url_encode group}/access_requests/#{user_id}/approve", body: options) | |
69 | end | |
70 | # Denies a project access request for the given user. | |
71 | # | |
72 | # @example | |
73 | # Gitlab.deny_project_access_request(1, 1) | |
74 | # | |
75 | # @param [Integer, String] :project(required) The ID or name of a project. | |
76 | # @param [Integer] :user_id(required) The user ID of the access requester | |
77 | # @return [void] This API call returns an empty response body. | |
78 | def deny_project_access_request(project, user_id) | |
79 | delete("/projects/#{url_encode project}/access_requests/#{user_id}") | |
80 | end | |
81 | # Denies a group access request for the given user. | |
82 | # | |
83 | # @example | |
84 | # Gitlab.deny_group_access_request(1, 1) | |
85 | # | |
86 | # @param [Integer, String] :group(required) The ID or name of a group. | |
87 | # @param [Integer] :user_id(required) The user ID of the access requester | |
88 | # @return [void] This API call returns an empty response body. | |
89 | def deny_group_access_request(group, user_id) | |
90 | delete("/groups/#{url_encode group}/access_requests/#{user_id}") | |
91 | end | |
92 | end | |
93 | end⏎ |
26 | 26 | # @param [String] branch The name of the branch. |
27 | 27 | # @return [Gitlab::ObjectifiedHash] |
28 | 28 | def branch(project, branch) |
29 | get("/projects/#{url_encode project}/repository/branches/#{branch}") | |
29 | get("/projects/#{url_encode project}/repository/branches/#{url_encode branch}") | |
30 | 30 | end |
31 | 31 | alias_method :repo_branch, :branch |
32 | 32 | |
46 | 46 | # @option options [Boolean] :developers_can_merge True to allow developers to merge into the branch (default = false) |
47 | 47 | # @return [Gitlab::ObjectifiedHash] Details about the branch |
48 | 48 | def protect_branch(project, branch, options = {}) |
49 | put("/projects/#{url_encode project}/repository/branches/#{branch}/protect", body: options) | |
49 | post("/projects/#{url_encode project}/protected_branches", body: {name: branch}.merge(options)) | |
50 | 50 | end |
51 | 51 | alias_method :repo_protect_branch, :protect_branch |
52 | 52 | |
60 | 60 | # @param [String] branch The name of the branch. |
61 | 61 | # @return [Gitlab::ObjectifiedHash] Details about the branch |
62 | 62 | def unprotect_branch(project, branch) |
63 | put("/projects/#{url_encode project}/repository/branches/#{branch}/unprotect") | |
63 | delete("/projects/#{url_encode project}/protected_branches/#{url_encode branch}") | |
64 | 64 | end |
65 | 65 | alias_method :repo_unprotect_branch, :unprotect_branch |
66 | 66 | |
67 | 67 | # Creates a repository branch. Requires Gitlab >= 6.8.x |
68 | 68 | # |
69 | 69 | # @example |
70 | # Gitlab.create_branch(3, 'api') | |
71 | # Gitlab.repo_create_branch(5, 'master') | |
70 | # Gitlab.create_branch(3, 'api', 'feat/new-api') | |
71 | # Gitlab.repo_create_branch(5, 'master', 'develop') | |
72 | 72 | # |
73 | 73 | # @param [Integer, String] project The ID or name of a project. |
74 | 74 | # @param [String] branch The name of the new branch. |
75 | 75 | # @param [String] ref Create branch from commit sha or existing branch |
76 | 76 | # @return [Gitlab::ObjectifiedHash] Details about the branch |
77 | 77 | def create_branch(project, branch, ref) |
78 | post("/projects/#{url_encode project}/repository/branches", body: { branch: branch, ref: ref }) | |
78 | post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref }) | |
79 | 79 | end |
80 | 80 | alias_method :repo_create_branch, :create_branch |
81 | 81 | |
88 | 88 | # @param [Integer, String] project The ID or name of a project. |
89 | 89 | # @param [String] branch The name of the branch to delete |
90 | 90 | def delete_branch(project, branch) |
91 | delete("/projects/#{url_encode project}/repository/branches/#{branch}") | |
91 | delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}") | |
92 | 92 | end |
93 | 93 | alias_method :repo_delete_branch, :delete_branch |
94 | 94 | end |
0 | 0 | class Gitlab::Client |
1 | 1 | # Defines methods related to builds. |
2 | 2 | # @see https://docs.gitlab.com/ce/api/build_variables.html |
3 | # @see https://docs.gitlab.com/ee/api/group_level_variables.html | |
3 | 4 | module BuildVariables |
4 | 5 | # Gets a list of the project's build variables |
5 | 6 | # |
15 | 16 | # Gets details of a project's specific build variable. |
16 | 17 | # |
17 | 18 | # @example |
18 | # Gitlab.build(5, "TEST_VARIABLE_1") | |
19 | # Gitlab.variable(5, "TEST_VARIABLE_1") | |
19 | 20 | # |
20 | 21 | # @param [Integer, String] project The ID or name of a project. |
21 | 22 | # @param [String] key The key of a variable. |
40 | 41 | # Update a project's build variable. |
41 | 42 | # |
42 | 43 | # @example |
43 | # Gitlab.create_variable(5, "NEW_VARIABLE", "updated value") | |
44 | # Gitlab.update_variable(5, "NEW_VARIABLE", "updated value") | |
44 | 45 | # |
45 | 46 | # @param [Integer, String] project The ID or name of a project. |
46 | 47 | # @param [String] key The key of a variable |
61 | 62 | def remove_variable(project, key) |
62 | 63 | delete("/projects/#{url_encode project}/variables/#{key}") |
63 | 64 | end |
65 | ||
66 | # Gets a list of the group's build variables | |
67 | # | |
68 | # @example | |
69 | # Gitlab.group_variables(5) | |
70 | # | |
71 | # @param [Integer, String] group The ID or name of a group. | |
72 | # @return [Array<Gitlab::ObjectifiedHash>] The list of variables. | |
73 | def group_variables(group) | |
74 | get("/groups/#{url_encode group}/variables") | |
75 | end | |
76 | ||
77 | # Gets details of a group's specific build variable. | |
78 | # | |
79 | # @example | |
80 | # Gitlab.group_variable(5, "TEST_VARIABLE_1") | |
81 | # | |
82 | # @param [Integer, String] group The ID or name of a group. | |
83 | # @param [String] key The key of a variable. | |
84 | # @return [Gitlab::ObjectifiedHash] The variable. | |
85 | def group_variable(group, key) | |
86 | get("/groups/#{url_encode group}/variables/#{key}") | |
87 | end | |
88 | ||
89 | # Create a build variable for a group. | |
90 | # | |
91 | # @example | |
92 | # Gitlab.create_group_variable(5, "NEW_VARIABLE", "new value") | |
93 | # | |
94 | # @param [Integer, String] group The ID or name of a group. | |
95 | # @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 | |
96 | # @param [String] value The value of a variable | |
97 | # @return [Gitlab::ObjectifiedHash] The variable. | |
98 | def create_group_variable(group, key, value) | |
99 | post("/groups/#{url_encode group}/variables", body: { key: key, value: value }) | |
100 | end | |
101 | ||
102 | # Update a group's build variable. | |
103 | # | |
104 | # @example | |
105 | # Gitlab.update_group_variable(5, "NEW_VARIABLE", "updated value") | |
106 | # | |
107 | # @param [Integer, String] group The ID or name of a group. | |
108 | # @param [String] key The key of a variable | |
109 | # @param [String] value The value of a variable | |
110 | # @return [Gitlab::ObjectifiedHash] The variable. | |
111 | def update_group_variable(group, key, value) | |
112 | put("/groups/#{url_encode group}/variables/#{key}", body: { value: value }) | |
113 | end | |
114 | ||
115 | # Remove a group's build variable. | |
116 | # | |
117 | # @example | |
118 | # Gitlab.remove_group_variable(5, "VARIABLE_1") | |
119 | # | |
120 | # @param [Integer, String] group The ID or name of a group. | |
121 | # @param [String] key The key of a variable. | |
122 | # @return [Gitlab::ObjectifiedHash] The variable. | |
123 | def remove_group_variable(group, key) | |
124 | delete("/groups/#{url_encode group}/variables/#{key}") | |
125 | end | |
64 | 126 | end |
65 | 127 | end |
141 | 141 | }.merge(options) |
142 | 142 | post("/projects/#{url_encode project}/repository/commits", body: payload) |
143 | 143 | end |
144 | ||
145 | # Gets a list of merge requests for a commit. | |
146 | # | |
147 | # @see https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit | |
148 | # Introduced in Gitlab 10.7 | |
149 | # | |
150 | # @example | |
151 | # Gitlab.commit_merge_requests(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b') | |
152 | # | |
153 | # @param [Integer] project The ID of a project. | |
154 | # @param [String] sha The commit hash. | |
155 | # @option options [Integer] :page The page number. | |
156 | # @option options [Integer] :per_page The number of results per page. | |
157 | # @return [Array<Gitlab::ObjectifiedHash>] | |
158 | def commit_merge_requests(project, commit, options={}) | |
159 | get("/projects/#{url_encode project}/repository/commits/#{commit}/merge_requests", query: options) | |
160 | end | |
161 | alias_method :repo_commit_merge_requests, :commit_merge_requests | |
144 | 162 | end |
145 | 163 | end |
0 | class Gitlab::Client | |
1 | # Defines methods related to deployments. | |
2 | # @see https://docs.gitlab.com/ce/api/deployments.html | |
3 | module Deployments | |
4 | # Gets a list of project deployments. | |
5 | # | |
6 | # @example | |
7 | # Gitlab.deployments(5) | |
8 | # Gitlab.deployments(5, { per_page: 10, page: 2 }) | |
9 | # | |
10 | # @param [Integer, String] project The ID or name of a project. | |
11 | # @param [Hash] options A customizable set of options. | |
12 | # @option options [Integer] :page The page number. | |
13 | # @option options [Integer] :per_page The number of results per page. | |
14 | # @return [Array<Gitlab::ObjectifiedHash>] | |
15 | def deployments(project, options={}) | |
16 | get("/projects/#{url_encode project}/deployments", query: options) | |
17 | end | |
18 | ||
19 | # Gets a single deployment. | |
20 | # | |
21 | # @example | |
22 | # Gitlab.deployment(5, 36) | |
23 | # | |
24 | # @param [Integer, String] project The ID or name of a project. | |
25 | # @param [Integer] id The ID of an deployment. | |
26 | # @return [Gitlab::ObjectifiedHash] | |
27 | def deployment(project, id) | |
28 | get("/projects/#{url_encode project}/deployments/#{id}") | |
29 | end | |
30 | end | |
31 | end |
0 | class Gitlab::Client | |
1 | # Defines methods related to events. | |
2 | # @see https://docs.gitlab.com/ce/api/events.html | |
3 | module Events | |
4 | # Gets a list of authenticated user's events | |
5 | # | |
6 | # @example | |
7 | # Gitlab.events() | |
8 | # Gitlab.events({ action: 'created', target_type: 'issue' }) | |
9 | # | |
10 | # @param [Hash] options A customizable set of options. | |
11 | # @option options [String] :action Only events of specific action type | |
12 | # @option options [String] :target_type Only events of specific target type | |
13 | # @option options [String] :before Only events created before YYYY-MM-DD | |
14 | # @option options [String] :after Only events created after YYYY-MM-DD | |
15 | # @option options [String] :sort Sort by created_at either 'asc' or 'desc' | |
16 | # @return [Array<Gitlab::ObjectifiedHash>] | |
17 | def events(options={}) | |
18 | get('/events', query: options) | |
19 | end | |
20 | ||
21 | # Gets a list of user contribution events | |
22 | # | |
23 | # @example | |
24 | # Gitlab.user_events(1) | |
25 | # Gitlab.user_events(1, { action: created}) | |
26 | # | |
27 | # @param [Integer, String] user The ID or username of user | |
28 | # @param [Hash] options A customizable set of options. | |
29 | # @option options [String] :action Only events of specific action type | |
30 | # @option options [String] :target_type Only events of specific target type | |
31 | # @option options [String] :before Only events created before YYYY-MM-DD | |
32 | # @option options [String] :after Only events created after YYYY-MM-DD | |
33 | # @option options [String] :sort Sort by created_at either 'asc' or 'desc' | |
34 | # @return [Array<Gitlab::ObjectifiedHash>] | |
35 | def user_events(user, options={}) | |
36 | get("/users/#{url_encode user}/events", query: options) | |
37 | end | |
38 | ||
39 | # Gets a list of visible project events | |
40 | # | |
41 | # @example | |
42 | # Gitlab.project_events(1) | |
43 | # Gitlab.project_events(1, { action: created }) | |
44 | # | |
45 | # @param [Integer] project The ID of project | |
46 | # @param [Hash] options A customizable set of options. | |
47 | # @option options [String] :action Only events of specific action type | |
48 | # @option options [String] :target_type Only events of specific target type | |
49 | # @option options [String] :before Only events created before YYYY-MM-DD | |
50 | # @option options [String] :after Only events created after YYYY-MM-DD | |
51 | # @option options [String] :sort Sort by created_at either 'asc' or 'desc' | |
52 | # @return [Array<Gitlab::ObjectifiedHash>] | |
53 | def project_events(project, options={}) | |
54 | get("/#{url_encode project}/events", query: options) | |
55 | end | |
56 | end | |
57 | end |
0 | class Gitlab::Client | |
1 | # Defines methods related to group milestones. | |
2 | # @see https://docs.gitlab.com/ee/api/group_milestones.html | |
3 | module GroupMilestones | |
4 | # Gets a list of a group's milestones. | |
5 | # | |
6 | # @example | |
7 | # Gitlab.group_milestones(5) | |
8 | # | |
9 | # @param [Integer, String] id The ID or name of a group. | |
10 | # @param [Hash] options A customizable set of options. | |
11 | # @option options [Integer] :page The page number. | |
12 | # @option options [Integer] :per_page The number of results per page. | |
13 | # @return [Array<Gitlab::ObjectifiedHash>] | |
14 | def group_milestones(id, options={}) | |
15 | get("/groups/#{url_encode id}/milestones", query: options) | |
16 | end | |
17 | ||
18 | # Gets a single group milestone. | |
19 | # | |
20 | # @example | |
21 | # Gitlab.group_milestone(5, 36) | |
22 | # | |
23 | # @param [Integer, String] id The ID or name of a group. | |
24 | # @param [Integer] milestone_id The ID of a milestone. | |
25 | # @return [Gitlab::ObjectifiedHash] | |
26 | def group_milestone(id, milestone_id) | |
27 | get("/groups/#{url_encode id}/milestones/#{milestone_id}") | |
28 | end | |
29 | ||
30 | # Creates a new group milestone. | |
31 | # | |
32 | # @example | |
33 | # Gitlab.create_group_milestone(5, 'v1.0') | |
34 | # | |
35 | # @param [Integer, String] id The ID or name of a group. | |
36 | # @param [String] title The title of a milestone. | |
37 | # @param [Hash] options A customizable set of options. | |
38 | # @option options [String] :description The description of a milestone. | |
39 | # @option options [String] :due_date The due date of a milestone. | |
40 | # @return [Gitlab::ObjectifiedHash] Information about created milestone. | |
41 | def create_group_milestone(id, title, options={}) | |
42 | body = { title: title }.merge(options) | |
43 | post("/groups/#{url_encode id}/milestones", body: body) | |
44 | end | |
45 | ||
46 | # Updates a group milestone. | |
47 | # | |
48 | # @example | |
49 | # Gitlab.edit_group_milestone(5, 2, { state_event: 'activate' }) | |
50 | # | |
51 | # @param [Integer, String] id The ID or name of a group. | |
52 | # @param [Integer] milestone_id The ID of a milestone. | |
53 | # @param [Hash] options A customizable set of options. | |
54 | # @option options [String] :title The title of a milestone. | |
55 | # @option options [String] :description The description of a milestone. | |
56 | # @option options [String] :due_date The due date of a milestone. | |
57 | # @option options [String] :state_event The state of a milestone ('close' or 'activate'). | |
58 | # @return [Gitlab::ObjectifiedHash] Information about updated milestone. | |
59 | def edit_group_milestone(id, milestone_id, options={}) | |
60 | put("/groups/#{url_encode id}/milestones/#{milestone_id}", body: options) | |
61 | end | |
62 | ||
63 | # Gets the issues of a given group milestone. | |
64 | # | |
65 | # @example | |
66 | # Gitlab.group_milestone_issues(5, 2) | |
67 | # | |
68 | # @param [Integer, String] id The ID or name of a group. | |
69 | # @param [Integer, String] milestone_id The ID of a milestone. | |
70 | # @option options [Integer] :page The page number. | |
71 | # @option options [Integer] :per_page The number of results per page. | |
72 | # @return [Array<Gitlab::ObjectifiedHash>] | |
73 | def group_milestone_issues(id, milestone_id, options={}) | |
74 | get("/groups/#{url_encode id}/milestones/#{milestone_id}/issues", query: options) | |
75 | end | |
76 | ||
77 | # Gets the merge_requests of a given group milestone. | |
78 | # | |
79 | # @example | |
80 | # Gitlab.group_milestone_merge_requests(5, 2) | |
81 | # | |
82 | # @param [Integer, String] group The ID or name of a group. | |
83 | # @param [Integer, String] milestone_id The ID of a milestone. | |
84 | # @option options [Integer] :page The page number. | |
85 | # @option options [Integer] :per_page The number of results per page. | |
86 | # @return [Array<Gitlab::ObjectifiedHash>] | |
87 | def group_milestone_merge_requests(id, milestone_id, options={}) | |
88 | get("/groups/#{url_encode id}/milestones/#{milestone_id}/merge_requests", query: options) | |
89 | end | |
90 | end | |
91 | end | |
92 |
23 | 23 | # @param [Integer] id The ID of a group. |
24 | 24 | # @return [Gitlab::ObjectifiedHash] |
25 | 25 | def group(id) |
26 | get("/groups/#{id}") | |
26 | get("/groups/#{url_encode id}") | |
27 | 27 | end |
28 | 28 | |
29 | 29 | # Creates a new group. |
47 | 47 | # @param [Integer] id The ID of a group |
48 | 48 | # @return [Gitlab::ObjectifiedHash] Information about the deleted group. |
49 | 49 | def delete_group(id) |
50 | delete("/groups/#{id}") | |
50 | delete("/groups/#{url_encode id}") | |
51 | 51 | end |
52 | 52 | |
53 | 53 | # Get a list of group members. |
62 | 62 | # @option options [Integer] :per_page The number of results per page. |
63 | 63 | # @return [Array<Gitlab::ObjectifiedHash>] |
64 | 64 | def group_members(id, options={}) |
65 | get("/groups/#{id}/members", query: options) | |
65 | get("/groups/#{url_encode id}/members", query: options) | |
66 | end | |
67 | ||
68 | # Get details of a single group member. | |
69 | # | |
70 | # @example | |
71 | # Gitlab.group_member(1, 10) | |
72 | # | |
73 | # @param [Integer] team_id The ID of the group to find a member in. | |
74 | # @param [Integer] user_id The user id of the member to find. | |
75 | # @return [Gitlab::ObjectifiedHash] (id, username, name, email, state, access_level ...) | |
76 | def group_member(team_id, user_id) | |
77 | get("/groups/#{url_encode team_id}/members/#{user_id}") | |
66 | 78 | end |
67 | 79 | |
68 | 80 | # Adds a user to group. |
75 | 87 | # @param [Integer] access_level Project access level. |
76 | 88 | # @return [Gitlab::ObjectifiedHash] Information about added team member. |
77 | 89 | def add_group_member(team_id, user_id, access_level) |
78 | post("/groups/#{team_id}/members", body: { user_id: user_id, access_level: access_level }) | |
90 | post("/groups/#{url_encode team_id}/members", body: { user_id: user_id, access_level: access_level }) | |
79 | 91 | end |
80 | 92 | |
81 | 93 | # Edit a user of a group. |
88 | 100 | # @param [Integer] access_level Project access level. |
89 | 101 | # @return [Gitlab::ObjectifiedHash] Information about edited team member. |
90 | 102 | def edit_group_member(team_id, user_id, access_level) |
91 | put("/groups/#{team_id}/members/#{user_id}", body: { access_level: access_level }) | |
103 | put("/groups/#{url_encode team_id}/members/#{user_id}", body: { access_level: access_level }) | |
92 | 104 | end |
93 | 105 | |
94 | 106 | # Removes user from user group. |
100 | 112 | # @param [Integer] user_id The ID of a user. |
101 | 113 | # @return [Gitlab::ObjectifiedHash] Information about removed team member. |
102 | 114 | def remove_group_member(team_id, user_id) |
103 | delete("/groups/#{team_id}/members/#{user_id}") | |
115 | delete("/groups/#{url_encode team_id}/members/#{user_id}") | |
104 | 116 | end |
105 | 117 | |
106 | 118 | # Transfers a project to a group |
112 | 124 | # @param [Integer] project_id The ID of a project. |
113 | 125 | def transfer_project_to_group(id, project_id) |
114 | 126 | body = { id: id, project_id: project_id } |
115 | post("/groups/#{id}/projects/#{project_id}", body: body) | |
127 | post("/groups/#{url_encode id}/projects/#{project_id}", body: body) | |
116 | 128 | end |
117 | 129 | |
118 | 130 | # Search for groups by name |
137 | 149 | # @param [Integer] id The ID of a group |
138 | 150 | # @return [Array<Gitlab::ObjectifiedHash>] List of projects under a group |
139 | 151 | def group_projects(id, options={}) |
140 | get("/groups/#{id}/projects", query: options) | |
152 | get("/groups/#{url_encode id}/projects", query: options) | |
153 | end | |
154 | ||
155 | # Get a list of subgroups under a group | |
156 | # @example | |
157 | # Gitlab.group_subgroups(1) | |
158 | # | |
159 | # @param [Integer] id the ID of a group | |
160 | # @param [Hash] options A customizable set of options. | |
161 | # @option options [String] :skip_groups Skip the group IDs passed. | |
162 | # @option options [String] :all_available Show all the groups you have access to (defaults to false for authenticated users). | |
163 | # @option options [String] :search Return the list of authorized groups matching the search criteria. | |
164 | # @option options [String] :order_by Order groups by name or path. Default is name. | |
165 | # @option options [String] :sort Order groups in asc or desc order. Default is asc. | |
166 | # @option options [String] :statistics Include group statistics (admins only). | |
167 | # @option options [String] :owned Limit to groups owned by the current user. | |
168 | # @return [Array<Gitlab::ObjectifiedHash>] List of subgroups under a group | |
169 | def group_subgroups(id, options={}) | |
170 | get("/groups/#{url_encode id}/subgroups", query: options) | |
171 | end | |
172 | ||
173 | # Updates an existing group. | |
174 | # | |
175 | # @example | |
176 | # Gitlab.edit_group(42) | |
177 | # Gitlab.edit_group(42, { name: 'Group Name' }) | |
178 | # | |
179 | # @param [Integer] group The ID. | |
180 | # @param [Hash] options A customizable set of options | |
181 | # @option options [String] :name The name of the group. | |
182 | # @option options [String] :path The path of the group. | |
183 | # @option options [String] :description The description of the group. | |
184 | # @option options [String] :visibility The visibility level of the group. Can be private, internal, or public | |
185 | # @option options [String] :lfs_enabled Enable/disable Large File Storage (LFS) for the projects in this groupr. | |
186 | # @option options [String] :request_access_enabled Allow users to request member access. | |
187 | # @return [Gitlab::ObjectifiedHash] Information about the edited group. | |
188 | def edit_group(id, options={}) | |
189 | put("/groups/#{url_encode id}", body: options) | |
141 | 190 | end |
142 | 191 | end |
143 | 192 | end |
132 | 132 | def delete_issue(project, id) |
133 | 133 | delete("/projects/#{url_encode project}/issues/#{id}") |
134 | 134 | end |
135 | ||
136 | # Move an issue. | |
137 | # | |
138 | # @example | |
139 | # Gitlab.move_issue(3, 42, { to_project_id: '4' }) | |
140 | # | |
141 | # @param [Integer, String] project The ID or name of a project. | |
142 | # @param [Integer] id The ID of an issue. | |
143 | # @option options [String] :to_project_id The ID of the new project. | |
144 | # @return [Gitlab::ObjectifiedHash] Information about moved issue. | |
145 | def move_issue(project, id, options={}) | |
146 | post("/projects/#{url_encode project}/issues/#{id}/move", body: options) | |
147 | end | |
148 | ||
149 | # Sets an estimated time of work for an issue. | |
150 | # | |
151 | # @example | |
152 | # Gitlab.estimate_time_of_issue(3, 42, '3h30m') | |
153 | # | |
154 | # @param [Integer, String] project The ID or name of a project. | |
155 | # @param [Integer] id The ID of an issue. | |
156 | # @param [String] duration The duration in human format. e.g: 3h30m | |
157 | def estimate_time_of_issue(project, id, duration) | |
158 | post("/projects/#{url_encode project}/issues/#{id}/time_estimate", body: { duration: url_encode(duration) }) | |
159 | end | |
160 | ||
161 | # Resets the estimated time for an issue to 0 seconds. | |
162 | # | |
163 | # @example | |
164 | # Gitlab.reset_time_estimate_of_issue(3, 42) | |
165 | # | |
166 | # @param [Integer, String] project The ID or name of a project. | |
167 | # @param [Integer] id The ID of an issue. | |
168 | def reset_time_estimate_of_issue(project, id) | |
169 | post("/projects/#{url_encode project}/issues/#{id}/reset_time_estimate") | |
170 | end | |
171 | ||
172 | # Adds spent time for an issue | |
173 | # | |
174 | # @example | |
175 | # Gitlab.estimate_time_of_issue(3, 42, '3h30m') | |
176 | # | |
177 | # @param [Integer, String] project The ID or name of a project. | |
178 | # @param [Integer] id The ID of an issue. | |
179 | # @param [String] duration The time spent in human format. e.g: 3h30m | |
180 | def add_time_spent_on_issue(project, id, duration) | |
181 | post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: url_encode(duration) }) | |
182 | end | |
183 | ||
184 | # Resets the total spent time for this issue to 0 seconds. | |
185 | # | |
186 | # @example | |
187 | # Gitlab.reset_time_spent_on_issue(3, 42) | |
188 | # | |
189 | # @param [Integer, String] project The ID or name of a project. | |
190 | # @param [Integer] id The ID of an issue. | |
191 | def reset_time_spent_on_issue(project, id) | |
192 | post("/projects/#{url_encode project}/issues/#{id}/reset_spent_time") | |
193 | end | |
194 | ||
195 | # Get time tracking stats for an issue | |
196 | # | |
197 | # @example | |
198 | # @gitlab.time_stats_for_issue(3, 42) | |
199 | # | |
200 | # @param [Integer, String] project The ID or name of a project. | |
201 | # @param [Integer] id The ID of an issue. | |
202 | def time_stats_for_issue(project, id) | |
203 | get("/projects/#{url_encode project}/issues/#{id}/time_stats") | |
204 | end | |
205 | ||
135 | 206 | end |
136 | 207 | end |
8 | 8 | # |
9 | 9 | # @param [Integer, String] project The ID or name of a project. |
10 | 10 | # @return [Array<Gitlab::ObjectifiedHash>] |
11 | def labels(project) | |
12 | get("/projects/#{url_encode project}/labels") | |
11 | def labels(project, options={}) | |
12 | get("/projects/#{url_encode project}/labels", query: options) | |
13 | 13 | end |
14 | 14 | |
15 | 15 | # Creates a new label. |
0 | class Gitlab::Client | |
1 | # Defines methods related to MR Approvals. | |
2 | # @see https://docs.gitlab.com/ee/api/merge_request_approvals.html | |
3 | module MergeRequestApprovals | |
4 | # Gets MR Approval Configuration for a project | |
5 | # | |
6 | # @example | |
7 | # Gitlab.project_merge_request_approvals(1) | |
8 | # | |
9 | # @param [Integer] project The ID of a project. | |
10 | # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project | |
11 | def project_merge_request_approvals(project) | |
12 | get("/projects/#{url_encode project}/approvals") | |
13 | end | |
14 | ||
15 | # Change MR Approval Configuration for a project | |
16 | # | |
17 | # @example | |
18 | # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3}) | |
19 | # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, reset_approvals_on_push: true}) | |
20 | # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, disable_overriding_approvers_per_merge_request: false}) | |
21 | # | |
22 | # @param [Integer] project(required) The ID of a project. | |
23 | # @option options [Integer] :approvals_before_merge(optional) How many approvals are required before an MR can be merged | |
24 | # @option options [Boolean] :reset_approvals_on_push(optional) Reset approvals on a new push | |
25 | # @option options [Boolean] :disable_overriding_approvers_per_merge_request(optional) Allow/Disallow overriding approvers per MR | |
26 | # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project | |
27 | def edit_project_merge_request_approvals(project, options = {}) | |
28 | post("/projects/#{url_encode project}/approvals", body: options) | |
29 | end | |
30 | ||
31 | # Change allowed approvers and approver groups for a project | |
32 | # | |
33 | # @example | |
34 | # Gitlab.edit_project_approvers(1, {approver_ids: [5], approver_groups: [1]}) | |
35 | # | |
36 | # @param [Integer] project(required) The ID of a project. | |
37 | # @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs | |
38 | # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs | |
39 | # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project | |
40 | def edit_project_approvers(project, options = {}) | |
41 | put("/projects/#{url_encode project}/approvals", body: options) | |
42 | end | |
43 | ||
44 | # Get Configuration for approvals on a specific Merge Request. | |
45 | # | |
46 | # @example | |
47 | # Gitlab.merge_request_approvals(1, 5) | |
48 | # | |
49 | # @param [Integer] project(required) The ID of a project. | |
50 | # @param [Integer] merge_request(required) The IID of a merge_request. | |
51 | # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the merge request | |
52 | def merge_request_approvals(project, merge_request) | |
53 | get("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals") | |
54 | end | |
55 | ||
56 | # Change configuration for approvals on a specific merge request. | |
57 | # | |
58 | # @example | |
59 | # Gitlab.edit_merge_request_approvals(1, 5, approvals_required: 2) | |
60 | # | |
61 | # @param [Integer] project(required) The ID of a project. | |
62 | # @param [Integer] merge_request(required) The IID of a merge_request. | |
63 | # @option options [Integer] :approvals_required(required) Approvals required before MR can be merged | |
64 | # @return [Gitlab::ObjectifiedHash] Updated MR approval configuration information about the merge request | |
65 | def edit_merge_request_approvals(project, merge_request, options = {}) | |
66 | post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options) | |
67 | end | |
68 | ||
69 | # Change allowed approvers and approver groups for a merge request | |
70 | # | |
71 | # @example | |
72 | # Gitlab.edit_merge_request_approvers(1, 5, {approver_ids: [5], approver_groups: [1]}) | |
73 | # | |
74 | # @param [Integer] project(required) The ID of a project. | |
75 | # @param [Integer] merge_request(required) The IID of a merge_request. | |
76 | # @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs | |
77 | # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs | |
78 | # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project | |
79 | def edit_merge_request_approvers(project, merge_request, options = {}) | |
80 | put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options) | |
81 | end | |
82 | ||
83 | # Approve a merge request | |
84 | # | |
85 | # @example | |
86 | # Gitlab.approve_merge_request(1, 5) | |
87 | # Gitlab.approve_merge_request(1, 5, sha: 'fe678da') | |
88 | # | |
89 | # @param [Integer] project(required) The ID of a project. | |
90 | # @param [Integer] merge_request(required) The IID of a merge request. | |
91 | # @option options [String] :sha(optional) The HEAD of the MR | |
92 | # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project | |
93 | def approve_merge_request(project, merge_request, options = {}) | |
94 | post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approve", body: options) | |
95 | end | |
96 | ||
97 | # Unapprove a merge request | |
98 | # | |
99 | # @example | |
100 | # Gitlab.unapprove_merge_request(1, 5) | |
101 | # | |
102 | # @param [Integer] project(required) The ID of a project. | |
103 | # @param [Integer] merge_request(required) The IID of a merge request. | |
104 | # @return [void] This API call returns an empty response body. | |
105 | def unapprove_merge_request(project, merge_request) | |
106 | post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove") | |
107 | end | |
108 | end | |
109 | end⏎ |
1 | 1 | # Defines methods related to merge requests. |
2 | 2 | # @see https://docs.gitlab.com/ce/api/merge_requests.html |
3 | 3 | module MergeRequests |
4 | # Gets a list of all of the merge requests the authenticated user has access to. | |
5 | # | |
6 | # @example | |
7 | # Gitlab.user_merge_requests | |
8 | # Gitlab.user_merge_requests(state: :opened, scope: :all) | |
9 | # | |
10 | # @param [Hash] options A customizable set of options. | |
11 | # @return [Array<Gitlab::ObjectifiedHash>] | |
12 | def user_merge_requests(options = {}) | |
13 | get('/merge_requests', query: options) | |
14 | end | |
15 | ||
4 | 16 | # Gets a list of project merge requests. |
5 | 17 | # |
6 | 18 | # @example |
7 | 19 | # Gitlab.merge_requests(5) |
8 | # Gitlab.merge_requests({ per_page: 40 }) | |
20 | # Gitlab.merge_requests(5, { per_page: 40 }) | |
9 | 21 | # |
10 | 22 | # @param [Integer, String] project The ID or name of a project. |
11 | 23 | # @param [Hash] options A customizable set of options. |
43 | 55 | # @option options [String] :target_branch (required) The target branch name. |
44 | 56 | # @option options [Integer] :assignee_id (optional) The ID of a user to assign merge request. |
45 | 57 | # @option options [Integer] :target_project_id (optional) The target project ID. |
58 | # @option options [String] :labels (optional) Labels as a comma-separated list. | |
46 | 59 | # @return [Gitlab::ObjectifiedHash] Information about created merge request. |
47 | 60 | def create_merge_request(project, title, options={}) |
48 | 61 | body = { title: title }.merge(options) |
141 | 154 | def unsubscribe_from_merge_request(project, id) |
142 | 155 | post("/projects/#{url_encode project}/merge_requests/#{id}/unsubscribe") |
143 | 156 | end |
157 | ||
158 | # List project merge request discussions | |
159 | # | |
160 | # @example | |
161 | # Gitlab.merge_request_discussions(5, 1) | |
162 | # Gitlab.merge_request_discussions('gitlab', 1) | |
163 | # @param [Integer, String] project The ID or name of a project. | |
164 | # @param [Integer] id The ID of a merge request. | |
165 | # @return [Gitlab::ObjectifiedHash] List of the merge request discussions. | |
166 | def merge_request_discussions(project, merge_request_id) | |
167 | get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions") | |
168 | end | |
169 | ||
170 | # Get single merge request discussion | |
171 | # | |
172 | # @example | |
173 | # Gitlab.merge_request_discussion(5, 1, 1) | |
174 | # Gitlab.merge_request_discussion('gitlab', 1, 1) | |
175 | # @param [Integer, String] project The ID or name of a project. | |
176 | # @param [Integer] id The ID of a merge request. | |
177 | # @param [Integer] discussion_id The ID of a discussion. | |
178 | # @return [Gitlab::ObjectifiedHash] The merge request discussion. | |
179 | def merge_request_discussion(project, merge_request_id, discussion_id) | |
180 | get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}") | |
181 | end | |
182 | ||
183 | # Create new merge request discussion | |
184 | # | |
185 | # @example | |
186 | # Gitlab.create_merge_request_discussion(5, 1, body: 'discuss') | |
187 | # Gitlab.create_merge_request_discussion('gitlab', 1, body: 'discuss') | |
188 | # @param [Integer, String] project The ID or name of a project. | |
189 | # @param [Integer] id The ID of a merge request. | |
190 | # @param [Hash] options A customizable set of options. | |
191 | # * :body (String) The content of a discussion | |
192 | # * :created_at (String) Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z | |
193 | # * :position (Hash) Position when creating a diff note | |
194 | # * :base_sha (String) Base commit SHA in the source branch | |
195 | # * :start_sha (String) SHA referencing commit in target branch | |
196 | # * :head_sha (String) SHA referencing HEAD of this merge request | |
197 | # * :position_type (String) Type of the position reference', allowed values: 'text' or 'image' | |
198 | # * :new_path (String) File path after change | |
199 | # * :new_line (Integer) Line number after change (for 'text' diff notes) | |
200 | # * :old_path (String) File path before change | |
201 | # * :old_line (Integer) Line number before change (for 'text' diff notes) | |
202 | # * :width (Integer) Width of the image (for 'image' diff notes) | |
203 | # * :height (Integer) Height of the image (for 'image' diff notes) | |
204 | # * :x (Integer) X coordinate (for 'image' diff notes) | |
205 | # * :y (Integer) Y coordinate (for 'image' diff notes) | |
206 | # @return [Gitlab::ObjectifiedHash] The created merge request discussion. | |
207 | def create_merge_request_discussion(project, merge_request_id, options={}) | |
208 | post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions", body: options) | |
209 | end | |
210 | ||
211 | # Resolve a merge request discussion | |
212 | # | |
213 | # @example | |
214 | # Gitlab.resolve_merge_request_discussion(5, 1, 1, true) | |
215 | # Gitlab.resolve_merge_request_discussion('gitlab', 1, 1, false) | |
216 | # @param [Integer, String] project The ID or name of a project. | |
217 | # @param [Integer] id The ID of a merge request. | |
218 | # @param [Integer] discussion_id The ID of a discussion. | |
219 | # @param [Hash] options A customizable set of options. | |
220 | # @option options [Boolean] :resolved Resolve/unresolve the discussion. | |
221 | # @return [Gitlab::ObjectifiedHash] The merge request discussion. | |
222 | def resolve_merge_request_discussion(project, merge_request_id, discussion_id, options) | |
223 | put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}", body: options) | |
224 | end | |
225 | ||
226 | # Add note to existing merge request discussion | |
227 | # | |
228 | # @example | |
229 | # Gitlab.create_merge_request_discussion_note(5, 1, 1, note_id: 1, body: 'note') | |
230 | # Gitlab.create_merge_request_discussion_note('gitlab', 1, 1, note_id: 1, body: 'note') | |
231 | # @param [Integer, String] project The ID or name of a project. | |
232 | # @param [Integer] id The ID of a merge request. | |
233 | # @param [Integer] discussion_id The ID of a discussion. | |
234 | # @param [Hash] options A customizable set of options. | |
235 | # @option options [Integer] :note_id The ID of a discussion note. | |
236 | # @option options [String] :body The content of a discussion. | |
237 | # @option options [String] :created_at Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z. | |
238 | # @return [Gitlab::ObjectifiedHash] The merge request discussion note. | |
239 | def create_merge_request_discussion_note(project, merge_request_id, discussion_id, options) | |
240 | post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes", body: options) | |
241 | end | |
242 | ||
243 | # Modify an existing merge request discussion note | |
244 | # | |
245 | # @example | |
246 | # Gitlab.update_merge_request_discussion_note(5, 1, 1, 1, body: 'note') | |
247 | # Gitlab.update_merge_request_discussion_note('gitlab', 1, 1, 1, body: 'note') | |
248 | # @param [Integer, String] project The ID or name of a project. | |
249 | # @param [Integer] id The ID of a merge request. | |
250 | # @param [Integer] discussion_id The ID of a discussion. | |
251 | # @param [Integer] note_id The ID of a discussion note. | |
252 | # @param [Hash] options A customizable set of options. | |
253 | # @option options [String] :body The content of a discussion. | |
254 | # @option options [Boolean] :resolved Resolve/unresolve the note. | |
255 | # @return [Gitlab::ObjectifiedHash] The merge request discussion note. | |
256 | def update_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id, options) | |
257 | put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}", body: options) | |
258 | end | |
259 | ||
260 | # Delete a merge request discussion note | |
261 | # | |
262 | # @example | |
263 | # Gitlab.delete_merge_request_discussion_note(5, 1, 1, 1) | |
264 | # Gitlab.delete_merge_request_discussion_note('gitlab', 1, 1, 1) | |
265 | # @param [Integer, String] project The ID or name of a project. | |
266 | # @param [Integer] id The ID of a merge request. | |
267 | # @param [Integer] discussion_id The ID of a discussion. | |
268 | # @param [Integer] note_id The ID of a discussion note. | |
269 | # @return [Gitlab::ObjectifiedHash] An empty response. | |
270 | def delete_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id) | |
271 | delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}") | |
272 | end | |
144 | 273 | end |
145 | 274 | end |
218 | 218 | # |
219 | 219 | # @param [Integer] project The ID of a project. |
220 | 220 | # @param [Integer] id The ID of a note. |
221 | # @param [String] body The content of a note. | |
221 | 222 | # @return [Gitlab::ObjectifiedHash] |
222 | 223 | def edit_note(project, id, body) |
223 | put("/projects/#{url_encode project}/notes/#{id}", body: body) | |
224 | put("/projects/#{url_encode project}/notes/#{id}", body: note_content(body)) | |
224 | 225 | end |
225 | 226 | |
226 | 227 | # Modifies an issue note. |
231 | 232 | # @param [Integer] project The ID of a project. |
232 | 233 | # @param [Integer] issue The ID of an issue. |
233 | 234 | # @param [Integer] id The ID of a note. |
235 | # @param [String] body The content of a note. | |
234 | 236 | # @return [Gitlab::ObjectifiedHash] |
235 | 237 | def edit_issue_note(project, issue, id, body) |
236 | put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: body) | |
238 | put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: note_content(body)) | |
237 | 239 | end |
238 | 240 | |
239 | 241 | # Modifies a snippet note. |
244 | 246 | # @param [Integer] project The ID of a project. |
245 | 247 | # @param [Integer] snippet The ID of a snippet. |
246 | 248 | # @param [Integer] id The ID of a note. |
249 | # @param [String] body The content of a note. | |
247 | 250 | # @return [Gitlab::ObjectifiedHash] |
248 | 251 | def edit_snippet_note(project, snippet, id, body) |
249 | put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: body) | |
252 | put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: note_content(body)) | |
250 | 253 | end |
251 | 254 | |
252 | 255 | # Modifies a merge_request note. |
257 | 260 | # @param [Integer] project The ID of a project. |
258 | 261 | # @param [Integer] merge_request The ID of a merge_request. |
259 | 262 | # @param [Integer] id The ID of a note. |
263 | # @param [String] body The content of a note. | |
260 | 264 | # @return [Gitlab::ObjectifiedHash] |
261 | 265 | def edit_merge_request_note(project, merge_request, id, body) |
262 | put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: body) | |
266 | put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: note_content(body)) | |
263 | 267 | end |
264 | 268 | alias_method :edit_merge_request_comment, :edit_merge_request_note |
269 | ||
270 | private | |
271 | ||
272 | # TODO: Remove this method after a couple deprecation cycles. Replace calls with the code | |
273 | # in the 'else'. | |
274 | def note_content(body) | |
275 | if body.is_a?(Hash) | |
276 | STDERR.puts "Passing the note body as a Hash is deprecated. You should just pass the String." | |
277 | body | |
278 | else | |
279 | { body: body } | |
280 | end | |
281 | end | |
265 | 282 | end |
266 | 283 | end |
0 | class Gitlab::Client | |
1 | # Defines methods related to pipeline schedules. | |
2 | # @see https://docs.gitlab.com/ce/api/pipeline_schedules.html | |
3 | module PipelineSchedules | |
4 | # Gets a list of project pipeline schedules. | |
5 | # | |
6 | # @example | |
7 | # Gitlab.pipeline_schedules(5) | |
8 | # Gitlab.pipeline_schedules(5, { scope: 'active' }) | |
9 | # | |
10 | # @param [Integer, String] project the ID or name of a project. | |
11 | # @param [Hash] options A customizable set of options. | |
12 | # @options options [String] :scope The scope of pipeline schedules, one of a 'active' or 'inactive'. | |
13 | # @return [Array<Gitlab::ObjectifiedHash>] | |
14 | def pipeline_schedules(project, options={}) | |
15 | get("/projects/#{url_encode project}/pipeline_schedules", query: options) | |
16 | end | |
17 | ||
18 | # Gets a single pipeline schedule. | |
19 | # | |
20 | # @example | |
21 | # Gitlab.pipeline_schedule(5, 3) | |
22 | # | |
23 | # @param [Integer, String] project The ID or name of a project. | |
24 | # @param [Integer] id The ID of the pipeline schedule. | |
25 | # @return [Gitlab::ObjectifiedHash] | |
26 | def pipeline_schedule(project, id) | |
27 | get("/projects/#{url_encode project}/pipeline_schedules/#{id}") | |
28 | end | |
29 | ||
30 | # Create a pipeline schedule. | |
31 | # | |
32 | # @example | |
33 | # Gitlab.create_pipeline_schedule(5, { description: 'example' }) | |
34 | # | |
35 | # @param [Integer, String] project The ID or name of a project. | |
36 | # @param [Hash] options A customizable set of options. | |
37 | # @option options [String] :description The description of pipeline scehdule. | |
38 | # @option options [String] :ref The branch/tag name will be triggered. | |
39 | # @option options [String] :cron The cron (e.g. 0 1 * * *). | |
40 | # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC'). | |
41 | # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true). | |
42 | # @return [Array<Gitlab::ObjectifiedHash>] | |
43 | def create_pipeline_schedule(project, options={}) | |
44 | post("/projects/#{url_encode project}/pipeline_schedules", query: options) | |
45 | end | |
46 | ||
47 | # Updates the pipeline schedule of a project. | |
48 | # | |
49 | # @example | |
50 | # Gitlab.edit_pipeline_schedule(3, 2, { description: 'example2' }) | |
51 | # | |
52 | # @param [Integer, String] project The ID or name of a project. | |
53 | # @param [Integer] The pipeline schedule ID. | |
54 | # @param [Hash] options A customizable set of options. | |
55 | # @option options [String] :description The description of pipeline scehdule. | |
56 | # @option options [String] :ref The branch/tag name will be triggered. | |
57 | # @option options [String] :cron The cron (e.g. 0 1 * * *). | |
58 | # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC'). | |
59 | # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true). | |
60 | # @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule. | |
61 | def edit_pipeline_schedule(project, pipeline_schedule_id, options={}) | |
62 | put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}", query: options) | |
63 | end | |
64 | ||
65 | # Take ownership of a pipeline schedule. | |
66 | # | |
67 | # @example | |
68 | # Gitlab.pipeline_schedule_take_ownership(5, 1) | |
69 | # | |
70 | # @param [Integer, String] project The ID or name of a project. | |
71 | # @param [Integer] trigger_id The pipeline schedule ID. | |
72 | # @return [Gitlab::ObjectifiedHash] The updated pipeline schedule. | |
73 | def pipeline_schedule_take_ownership(project, pipeline_schedule_id) | |
74 | post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/take_ownership") | |
75 | end | |
76 | ||
77 | # Delete a pipeline schedule. | |
78 | # | |
79 | # @example | |
80 | # Gitlab.delete_pipeline_schedule(5, 1) | |
81 | # | |
82 | # @param [Integer, String] project The ID or name of a project. | |
83 | # @param [Integer] trigger_id The pipeline schedule ID. | |
84 | # @return [Gitlab::ObjectifiedHash] The deleted pipeline schedule. | |
85 | def delete_pipeline_schedule(project, pipeline_schedule_id) | |
86 | delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}") | |
87 | end | |
88 | ||
89 | # Create a pipeline schedule variable. | |
90 | # | |
91 | # @example | |
92 | # Gitlab.create_pipeline_schedule_variable(5, 1, { key: 'foo', value: 'bar' }) | |
93 | # | |
94 | # @param [Integer, String] project The ID or name of a project. | |
95 | # @param [Integer] trigger_id The pipeline schedule ID. | |
96 | # @param [Hash] options A customizable set of options. | |
97 | # @option options [String] :key The key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed. | |
98 | # @option options [String] :value The value of a variable | |
99 | # @return [Array<Gitlab::ObjectifiedHash>] The created pipeline schedule variable. | |
100 | def create_pipeline_schedule_variable(project, pipeline_schedule_id, options={}) | |
101 | post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables", query: options) | |
102 | end | |
103 | ||
104 | # Updates the variable of a pipeline schedule. | |
105 | # | |
106 | # @example | |
107 | # Gitlab.edit_pipeline_schedule_variable(3, 2, "foo" { value: 'bar' }) | |
108 | # | |
109 | # @param [Integer, String] project The ID or name of a project. | |
110 | # @param [Integer] The pipeline schedule ID. | |
111 | # @param [String] The key of a variable. | |
112 | # @param [Hash] options A customizable set of options. | |
113 | # @option options [String] :value The value of a variable. | |
114 | # @return [Array<Gitlab::ObjectifiedHash>] The updated pipeline schedule variable. | |
115 | def edit_pipeline_schedule_variable(project, pipeline_schedule_id, key, options={}) | |
116 | put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}", query: options) | |
117 | end | |
118 | ||
119 | # Delete the variable of a pipeline schedule | |
120 | # | |
121 | # @example | |
122 | # Gitlab.delete_pipeline_schedule_variable(3, 2, "foo") | |
123 | # | |
124 | # @param [Integer, String] project The ID or name of a project. | |
125 | # @param [Integer] The pipeline schedule ID. | |
126 | # @param [String] The key of a variable. | |
127 | # @return [Array<Gitlab::ObjectifiedHash>] The deleted pipeline schedule variable. | |
128 | def delete_pipeline_schedule_variable(project, pipeline_schedule_id, key, options={}) | |
129 | delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}") | |
130 | end | |
131 | end | |
132 | end |
79 | 79 | # Run the given project pipeline trigger. |
80 | 80 | # |
81 | 81 | # @example |
82 | # Gitlab.trigger_build(5, '7b9148c158980bbd9bcea92c17522d', 'master') | |
83 | # Gitlab.trigger_build(5, '7b9148c158980bbd9bcea92c17522d', 'master', { variable1: "value", variable2: "value2" }) | |
82 | # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master') | |
83 | # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master', { variable1: "value", variable2: "value2" }) | |
84 | 84 | # |
85 | 85 | # @see https://docs.gitlab.com/ce/ci/triggers/README.html |
86 | 86 | # |
9 | 9 | # @param [Hash] options A customizable set of options. |
10 | 10 | # @option options [Integer] :page The page number. |
11 | 11 | # @option options [Integer] :per_page The number of results per page. |
12 | # @option options [String] :scope Scope of projects. 'owned' for list of projects owned by the authenticated user, 'all' to get all projects (admin only) | |
12 | # (Any provided options will be passed to Gitlab. See {https://docs.gitlab.com/ce/api/projects.html#list-all-projects Gitlab docs} for all valid options) | |
13 | # | |
13 | 14 | # @return [Array<Gitlab::ObjectifiedHash>] |
14 | 15 | def projects(options={}) |
15 | if options[:scope] | |
16 | get("/projects/#{options[:scope]}", query: options) | |
17 | else | |
18 | get("/projects", query: options) | |
19 | end | |
16 | get("/projects", query: options) | |
20 | 17 | end |
21 | 18 | |
22 | 19 | # Search for projects by name. |
47 | 44 | # @return [Gitlab::ObjectifiedHash] |
48 | 45 | def project(id) |
49 | 46 | get("/projects/#{url_encode id}") |
50 | end | |
51 | ||
52 | # Gets a list of project events. | |
53 | # | |
54 | # @example | |
55 | # Gitlab.project_events(42) | |
56 | # Gitlab.project_events('gitlab') | |
57 | # | |
58 | # @param [Integer, String] project The ID or path of a project. | |
59 | # @param [Hash] options A customizable set of options. | |
60 | # @option options [Integer] :page The page number. | |
61 | # @option options [Integer] :per_page The number of results per page. | |
62 | # @return [Array<Gitlab::ObjectifiedHash>] | |
63 | def project_events(project, options={}) | |
64 | get("/projects/#{url_encode project}/events", query: options) | |
65 | 47 | end |
66 | 48 | |
67 | 49 | # Creates a new project. |
297 | 279 | # |
298 | 280 | # @param [Integer] id The ID of a project. |
299 | 281 | # @return [Gitlab::ObjectifiedHash] Information about deleted push rule. |
300 | def delete_push_rule(id, options={}) | |
282 | def delete_push_rule(id) | |
301 | 283 | delete("/projects/#{url_encode id}/push_rule") |
302 | 284 | end |
303 | 285 | |
354 | 336 | # Creates a new deploy key. |
355 | 337 | # |
356 | 338 | # @example |
357 | # Gitlab.create_deploy_key(42, 'My Key', 'Key contents') | |
339 | # Gitlab.create_deploy_key(42, 'My Key', 'Key contents', can_push: true) | |
358 | 340 | # |
359 | 341 | # @param [Integer, String] project The ID or path of a project. |
360 | 342 | # @param [String] title The title of a deploy key. |
361 | 343 | # @param [String] key The content of a deploy key. |
344 | # @param [Hash] options A customizable set of options. | |
362 | 345 | # @return [Gitlab::ObjectifiedHash] Information about created deploy key. |
363 | def create_deploy_key(project, title, key) | |
364 | post("/projects/#{url_encode project}/deploy_keys", body: { title: title, key: key }) | |
346 | def create_deploy_key(project, title, key, options = {}) | |
347 | post("/projects/#{url_encode project}/deploy_keys", body: { title: title, key: key }.merge(options)) | |
365 | 348 | end |
366 | 349 | |
367 | 350 | # Enables a deploy key at the project. |
412 | 395 | # @return [Gitlab::ObjectifiedHash] Information about the forked project. |
413 | 396 | def create_fork(id, options={}) |
414 | 397 | post("/projects/#{url_encode id}/fork", body: options) |
398 | end | |
399 | ||
400 | # Get a list of all visible projects across GitLab for the authenticated user. | |
401 | # When accessed without authentication, only public projects are returned. | |
402 | # | |
403 | # Note: This feature was introduced in GitLab 10.1 | |
404 | # | |
405 | # @example | |
406 | # Gitlab.project_forks(42) | |
407 | # | |
408 | # @param [Hash] options A customizable set of options. | |
409 | # @option options [Integer] :page The page number. | |
410 | # @option options [Integer] :per_page The number of results per page. | |
411 | # @option options [String] :order_by Return requests ordered by id, name, created_at or last_activity_at fields | |
412 | # @option options [String] :sort Return requests sorted in asc or desc order | |
413 | # @return [Array<Gitlab::ObjectifiedHash>] | |
414 | def project_forks(id, options={}) | |
415 | get("/projects/#{url_encode id}/forks", query: options) | |
415 | 416 | end |
416 | 417 | |
417 | 418 | # Updates an existing project. |
445 | 446 | post("/projects/#{url_encode project}/share", body: { group_id: id, group_access: group_access }) |
446 | 447 | end |
447 | 448 | |
449 | # Unshare project with group. | |
450 | # | |
451 | # @example | |
452 | # Gitlab.unshare_project_with_group('gitlab', 2) | |
453 | # | |
454 | # @param [Integer, String] project The ID or path of a project. | |
455 | # @param [Integer] id The ID of a group. | |
456 | # @return [void] This API call returns an empty response body. | |
457 | def unshare_project_with_group(project, id) | |
458 | delete("/projects/#{url_encode project}/share/#{id}") | |
459 | end | |
460 | ||
448 | 461 | # Stars a project. |
449 | 462 | # @see https://docs.gitlab.com/ce/api/projects.html#star-a-project |
450 | 463 | # |
470 | 483 | def unstar_project(id) |
471 | 484 | delete("/projects/#{url_encode id}/star") |
472 | 485 | end |
486 | ||
487 | # Get a list of visible projects for the given user. | |
488 | # @see https://docs.gitlab.com/ee/api/projects.html#list-user-projects | |
489 | # | |
490 | # @example | |
491 | # Gitlab.user_projects(1) | |
492 | # Gitlab.user_projects(1, { order_by: 'last_activity_at' }) | |
493 | # Gitlab.user_projects('username', { order_by: 'name', sort: 'asc' }) | |
494 | # | |
495 | # @param [Integer, String] user_id The ID or username of the user. | |
496 | # @param [Hash] options A customizable set of options. | |
497 | # @option options [String] :per_page Number of projects to return per page | |
498 | # @option options [String] :page The page to retrieve | |
499 | # @option options [String] :order_by Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields. | |
500 | # @option options [String] :sort Return projects sorted in asc or desc order. | |
501 | # @return [Array<Gitlab::ObjectifiedHash>] | |
502 | def user_projects(user_id, options={}) | |
503 | get("/users/#{url_encode user_id}/projects", query: options) | |
504 | end | |
473 | 505 | end |
474 | 506 | end |
14 | 14 | # @param [String] ref The name of a repository branch or tag or if not given the default branch. |
15 | 15 | # @return [String] |
16 | 16 | def file_contents(project, filepath, ref='master') |
17 | ref = URI.encode(ref, /\W/) | |
18 | 17 | get "/projects/#{url_encode project}/repository/files/#{url_encode filepath}/raw", |
19 | 18 | query: { ref: ref}, |
20 | 19 | format: nil, |
94 | 93 | # @option options [String] :author_email Commit author's email address |
95 | 94 | # @return [Gitlab::ObjectifiedHash] |
96 | 95 | def remove_file(project, path, branch, commit_message, options = {}) |
97 | delete("/projects/#{url_encode project}/repository/files/#{url_encode path}", body: { | |
96 | delete("/projects/#{url_encode project}/repository/files/#{url_encode path}", | |
97 | body: { | |
98 | 98 | branch: branch, |
99 | 99 | commit_message: commit_message |
100 | 100 | }.merge(options)) |
71 | 71 | delete("/runners/#{id}") |
72 | 72 | end |
73 | 73 | |
74 | # Gets a list of Jobs for a Runner | |
75 | # | |
76 | # @example | |
77 | # Gitlab.runner_jobs(1) | |
78 | # | |
79 | # @param [Integer] id The ID of a runner. | |
80 | # @return [Array<Gitlab::ObjectifiedHash>] | |
81 | def runner_jobs(runner_id) | |
82 | get("/runners/#{url_encode runner_id}/jobs") | |
83 | end | |
84 | ||
74 | 85 | # 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. |
75 | 86 | # @see https://docs.gitlab.com/ce/api/runners.html#list-projects-runners |
76 | 87 | # |
0 | class Gitlab::Client | |
1 | # Defines methods related to sidekiq metrics. | |
2 | # @see https://docs.gitlab.com/ce/api/sidekiq_metrics.html | |
3 | module Sidekiq | |
4 | # Get the current Queue Metrics | |
5 | # | |
6 | # @example | |
7 | # Gitlab.sidekiq_queue_metrics | |
8 | def sidekiq_queue_metrics | |
9 | get('/sidekiq/queue_metrics') | |
10 | end | |
11 | ||
12 | # Get the current Process Metrics | |
13 | # | |
14 | # @example | |
15 | # Gitlab.sidekiq_process_metrics | |
16 | def sidekiq_process_metrics | |
17 | get('/sidekiq/process_metrics') | |
18 | end | |
19 | ||
20 | # Get the current Job Statistics | |
21 | # | |
22 | # @example | |
23 | # Gitlab.sidekiq_job_stats | |
24 | def sidekiq_job_stats | |
25 | get('/sidekiq/job_stats') | |
26 | end | |
27 | ||
28 | # Get a compound response of all the previously mentioned metrics | |
29 | # | |
30 | # @example | |
31 | # Gitlab.sidekiq_compound_metrics | |
32 | def sidekiq_compound_metrics | |
33 | get('/sidekiq/compound_metrics') | |
34 | end | |
35 | end | |
36 | end |
30 | 30 | # Creates a new snippet. |
31 | 31 | # |
32 | 32 | # @example |
33 | # Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code' }) | |
33 | # Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code', visibility: 'public'}) | |
34 | 34 | # |
35 | 35 | # @param [Integer, String] project The ID or name of a project. |
36 | 36 | # @param [Hash] options A customizable set of options. |
38 | 38 | # @option options [String] :file_name (required) The name of a snippet file. |
39 | 39 | # @option options [String] :code (required) The content of a snippet. |
40 | 40 | # @option options [String] :lifetime (optional) The expiration date of a snippet. |
41 | # @option options [String] :visibility (required) The visibility of a snippet | |
41 | 42 | # @return [Gitlab::ObjectifiedHash] Information about created snippet. |
42 | 43 | def create_snippet(project, options={}) |
43 | 44 | post("/projects/#{url_encode project}/snippets", body: options) |
55 | 56 | # @option options [String] :file_name The name of a snippet file. |
56 | 57 | # @option options [String] :code The content of a snippet. |
57 | 58 | # @option options [String] :lifetime The expiration date of a snippet. |
59 | # @option options [String] :visibility (optional) The visibility of a snippet | |
58 | 60 | # @return [Gitlab::ObjectifiedHash] Information about updated snippet. |
59 | 61 | def edit_snippet(project, id, options={}) |
60 | 62 | put("/projects/#{url_encode project}/snippets/#{id}", body: options) |
29 | 29 | # @param [String] description Optional release notes for tag. |
30 | 30 | # @return [Gitlab::ObjectifiedHash] |
31 | 31 | def create_tag(project, tag_name, ref, message='', description=nil) |
32 | post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, description: description }) | |
32 | post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, release_description: description }) | |
33 | 33 | end |
34 | 34 | alias_method :repo_create_tag, :create_tag |
35 | 35 | |
43 | 43 | # @param [String] tag The name of the tag. |
44 | 44 | # @return [Gitlab::ObjectifiedHash] |
45 | 45 | def tag(project, tag) |
46 | get("/projects/#{url_encode project}/repository/tags/#{tag}") | |
46 | get("/projects/#{url_encode project}/repository/tags/#{url_encode tag}") | |
47 | 47 | end |
48 | 48 | alias_method :repo_tag, :tag |
49 | 49 | |
57 | 57 | # @param [String] tag The name of the tag to delete |
58 | 58 | # @return [Gitlab::ObjectifiedHash] |
59 | 59 | def delete_tag(project, tag) |
60 | delete("/projects/#{url_encode project}/repository/tags/#{tag}") | |
60 | delete("/projects/#{url_encode project}/repository/tags/#{url_encode tag}") | |
61 | 61 | end |
62 | 62 | alias_method :repo_delete_tag, :delete_tag |
63 | 63 | |
72 | 72 | # @param [String] description Release notes with markdown support |
73 | 73 | # @return [Gitlab::ObjectifiedHash] |
74 | 74 | def create_release(project, tag, description) |
75 | post("/projects/#{url_encode project}/repository/tags/#{tag}/release", body: { description: description }) | |
75 | post("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description }) | |
76 | 76 | end |
77 | 77 | alias_method :repo_create_release, :create_release |
78 | 78 | |
87 | 87 | # @param [String] description Release notes with markdown support |
88 | 88 | # @return [Gitlab::ObjectifiedHash] |
89 | 89 | def update_release(project, tag, description) |
90 | put("/projects/#{url_encode project}/repository/tags/#{tag}/release", body: { description: description }) | |
90 | put("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description }) | |
91 | 91 | end |
92 | 92 | alias_method :repo_update_release, :update_release |
93 | 93 |
48 | 48 | # @return [Gitlab::ObjectifiedHash] Information about created user. |
49 | 49 | def create_user(*args) |
50 | 50 | options = Hash === args.last ? args.pop : {} |
51 | if args[2] | |
52 | body = { email: args[0], password: args[1], username: args[2] } | |
53 | else | |
54 | body = { email: args[0], password: args[1], name: args[0] } | |
55 | end | |
51 | body = if args[2] | |
52 | { email: args[0], password: args[1], username: args[2] } | |
53 | else | |
54 | { email: args[0], password: args[1], name: args[0] } | |
55 | end | |
56 | 56 | body.merge!(options) |
57 | 57 | post('/users', body: body) |
58 | 58 | end |
2 | 2 | class Client < API |
3 | 3 | Dir[File.expand_path('../client/*.rb', __FILE__)].each { |f| require f } |
4 | 4 | |
5 | # Please keep in alphabetical order | |
6 | include AccessRequests | |
5 | 7 | include AwardEmojis |
6 | 8 | include Boards |
7 | 9 | include Branches |
10 | include BuildVariables | |
8 | 11 | include Builds |
9 | include BuildVariables | |
10 | 12 | include Commits |
13 | include Deployments | |
11 | 14 | include Environments |
15 | include Events | |
16 | include GroupMilestones | |
12 | 17 | include Groups |
13 | 18 | include Issues |
19 | include Jobs | |
14 | 20 | include Keys |
15 | 21 | include Labels |
22 | include MergeRequestApprovals | |
16 | 23 | include MergeRequests |
17 | 24 | include Milestones |
18 | 25 | include Namespaces |
19 | 26 | include Notes |
27 | include PipelineSchedules | |
28 | include PipelineTriggers | |
20 | 29 | include Pipelines |
21 | include PipelineTriggers | |
22 | 30 | include Projects |
23 | 31 | include Repositories |
24 | 32 | include RepositoryFiles |
25 | 33 | include Runners |
26 | 34 | include Services |
35 | include Sidekiq | |
27 | 36 | include Snippets |
28 | 37 | include SystemHooks |
29 | 38 | include Tags |
30 | 39 | include Todos |
31 | 40 | include Users |
32 | include Jobs | |
33 | 41 | |
34 | 42 | # Text representation of the client, masking private token. |
35 | 43 | # |
45 | 53 | end |
46 | 54 | |
47 | 55 | def url_encode(s) |
48 | ERB::Util.url_encode(s) | |
56 | URI.encode(s.to_s, /\W/) | |
49 | 57 | end |
50 | 58 | |
51 | 59 | private |
52 | 60 | |
53 | 61 | def only_show_last_four_chars(token) |
54 | "#{'*'*(token.size - 4)}#{token[-4..-1]}" | |
62 | "#{'*' * (token.size - 4)}#{token[-4..-1]}" | |
55 | 63 | end |
56 | 64 | end |
57 | 65 | end |
2 | 2 | # Defines constants and methods related to configuration. |
3 | 3 | module Configuration |
4 | 4 | # An array of valid keys in the options hash when configuring a Gitlab::API. |
5 | VALID_OPTIONS_KEYS = [:endpoint, :private_token, :user_agent, :sudo, :httparty].freeze | |
5 | VALID_OPTIONS_KEYS = %i(endpoint private_token user_agent sudo httparty).freeze | |
6 | 6 | |
7 | 7 | # The user agent that will be sent to the API endpoint if none is set. |
8 | 8 | DEFAULT_USER_AGENT = "Gitlab Ruby Gem #{Gitlab::VERSION}".freeze |
47 | 47 | |
48 | 48 | httparty = Gitlab::CLI::Helpers.yaml_load(options) |
49 | 49 | |
50 | raise ArgumentError, "HTTParty config should be a Hash." unless httparty.is_a? Hash | |
50 | raise ArgumentError, 'HTTParty config should be a Hash.' unless httparty.is_a? Hash | |
51 | 51 | Gitlab::CLI::Helpers.symbolize_keys httparty |
52 | 52 | end |
53 | 53 | end |
10 | 10 | |
11 | 11 | # Custom error class for rescuing from HTTP response errors. |
12 | 12 | class ResponseError < Error |
13 | POSSIBLE_MESSAGE_KEYS = %i(message error_description error) | |
14 | ||
13 | 15 | def initialize(response) |
14 | 16 | @response = response |
15 | 17 | super(build_error_message) |
16 | 18 | end |
17 | 19 | |
18 | # Status code returned in the http response. | |
20 | # Status code returned in the HTTP response. | |
19 | 21 | # |
20 | 22 | # @return [Integer] |
21 | 23 | def response_status |
22 | 24 | @response.code |
25 | end | |
26 | ||
27 | # Body content returned in the HTTP response | |
28 | # | |
29 | # @return [String] | |
30 | def response_message | |
31 | @response.parsed_response.message | |
23 | 32 | end |
24 | 33 | |
25 | 34 | private |
29 | 38 | # @return [String] |
30 | 39 | def build_error_message |
31 | 40 | parsed_response = @response.parsed_response |
32 | message = parsed_response.message || parsed_response.error | |
33 | ||
41 | message = check_error_keys(parsed_response) | |
34 | 42 | "Server responded with code #{@response.code}, message: " \ |
35 | 43 | "#{handle_message(message)}. " \ |
36 | 44 | "Request URI: #{@response.request.base_uri}#{@response.request.path}" |
45 | end | |
46 | ||
47 | # Error keys vary across the API, find the first key that the parsed_response | |
48 | # object responds to and return that, otherwise return the original. | |
49 | def check_error_keys(resp) | |
50 | key = POSSIBLE_MESSAGE_KEYS.find { |k| resp.respond_to?(k) } | |
51 | key ? resp.send(key) : resp | |
37 | 52 | end |
38 | 53 | |
39 | 54 | # Handle error response message in case of nested hashes |
38 | 38 | |
39 | 39 | # Parse filename from the 'Content Disposition' header. |
40 | 40 | def parse_headers!(headers) |
41 | @filename = headers[HEADER_CONTENT_DISPOSITION].split("filename=")[1] | |
41 | @filename = headers[HEADER_CONTENT_DISPOSITION].split('filename=')[1] | |
42 | 42 | @filename = @filename[1...-1] if @filename[0] == '"' # Unquote filenames |
43 | 43 | end |
44 | 44 | end |
32 | 32 | def ri_cmd |
33 | 33 | which_ri = `which ri`.chomp |
34 | 34 | if which_ri.empty? |
35 | fail "'ri' tool not found in $PATH. Please install it to use the help." | |
35 | raise "'ri' tool not found in $PATH. Please install it to use the help." | |
36 | 36 | end |
37 | 37 | |
38 | 38 | which_ri |
60 | 60 | def actions_table(topic=nil) |
61 | 61 | rows = topic ? help_map[topic] : help_map.keys |
62 | 62 | table do |t| |
63 | t.title = topic || "Help Topics" | |
63 | t.title = topic || 'Help Topics' | |
64 | 64 | |
65 | 65 | # add_row expects an array and we have strings hence the map. |
66 | 66 | rows.sort.map { |r| [r] }.each_with_index do |row, index| |
72 | 72 | |
73 | 73 | # Returns full namespace of a command (e.g. Gitlab::Client::Branches.cmd) |
74 | 74 | def namespace(cmd) |
75 | method_owners.select { |method| method[:name] === cmd }. | |
75 | method_owners.select { |method| method[:name] == cmd }. | |
76 | 76 | map { |method| method[:owner] + '.' + method[:name] }. |
77 | 77 | shift |
78 | 78 | end |
81 | 81 | def change_help_output!(cmd, output_str) |
82 | 82 | output_str.gsub!(/#{cmd}\((.*?)\)/m, cmd + ' \1') |
83 | 83 | output_str.gsub!(/\,[\s]*/, ' ') |
84 | ||
84 | ||
85 | 85 | # Ensure @option descriptions are on a single line |
86 | 86 | output_str.gsub!(/\n\[/, " \[") |
87 | 87 | output_str.gsub!(/\s(@)/, "\n@") |
88 | 88 | output_str.gsub!(/(\])\n(\:)/, '\1 \2') |
89 | 89 | output_str.gsub!(/(\:.*)(\n)(.*\.)/, '\1 \3') |
90 | 90 | output_str.gsub!(/\{(.+)\}/, '"{\1}"') |
91 | ||
92 | 91 | end |
93 | end # class << self | |
92 | end | |
94 | 93 | end |
5 | 5 | HEADER_LINK = 'Link'.freeze |
6 | 6 | DELIM_LINKS = ','.freeze |
7 | 7 | LINK_REGEX = /<([^>]+)>; rel=\"([^\"]+)\"/ |
8 | METAS = %w(last next first prev) | |
8 | METAS = %w(last next first prev).freeze | |
9 | 9 | |
10 | 10 | attr_accessor(*METAS) |
11 | 11 | |
24 | 24 | LINK_REGEX.match(link.strip) do |match| |
25 | 25 | url, meta = match[1], match[2] |
26 | 26 | next if !url || !meta || METAS.index(meta).nil? |
27 | self.send("#{meta}=", url) | |
27 | send("#{meta}=", url) | |
28 | 28 | end |
29 | 29 | end |
30 | 30 | end |
25 | 25 | elsif body.nil? |
26 | 26 | false |
27 | 27 | else |
28 | raise Error::Parsing.new "Couldn't parse a response body" | |
28 | raise Error::Parsing, "Couldn't parse a response body" | |
29 | 29 | end |
30 | 30 | end |
31 | 31 | |
32 | 32 | # Decodes a JSON response into Ruby object. |
33 | 33 | def self.decode(response) |
34 | JSON.load response | |
34 | return response ? JSON.load(response) : {} | |
35 | 35 | rescue JSON::ParserError |
36 | raise Error::Parsing.new "The response is not a valid JSON" | |
36 | raise Error::Parsing, 'The response is not a valid JSON' | |
37 | 37 | end |
38 | 38 | |
39 | def get(path, options={}) | |
40 | set_httparty_config(options) | |
41 | set_authorization_header(options) | |
42 | validate self.class.get(@endpoint + path, options) | |
43 | end | |
44 | ||
45 | def post(path, options={}) | |
46 | set_httparty_config(options) | |
47 | set_authorization_header(options) | |
48 | validate self.class.post(@endpoint + path, options) | |
49 | end | |
50 | ||
51 | def put(path, options={}) | |
52 | set_httparty_config(options) | |
53 | set_authorization_header(options) | |
54 | validate self.class.put(@endpoint + path, options) | |
55 | end | |
56 | ||
57 | def delete(path, options={}) | |
58 | set_httparty_config(options) | |
59 | set_authorization_header(options) | |
60 | validate self.class.delete(@endpoint + path, options) | |
39 | %w(get post put delete).each do |method| | |
40 | define_method method do |path, options={}| | |
41 | httparty_config(options) | |
42 | authorization_header(options) | |
43 | validate self.class.send(method, @endpoint + path, options) | |
44 | end | |
61 | 45 | end |
62 | 46 | |
63 | 47 | # Checks the response code for common errors. |
64 | 48 | # Returns parsed response for successful requests. |
65 | 49 | def validate(response) |
66 | 50 | error_klass = case response.code |
67 | when 400 then Error::BadRequest | |
68 | when 401 then Error::Unauthorized | |
69 | when 403 then Error::Forbidden | |
70 | when 404 then Error::NotFound | |
71 | when 405 then Error::MethodNotAllowed | |
72 | when 409 then Error::Conflict | |
73 | when 422 then Error::Unprocessable | |
74 | when 500 then Error::InternalServerError | |
75 | when 502 then Error::BadGateway | |
76 | when 503 then Error::ServiceUnavailable | |
77 | end | |
51 | when 400 then Error::BadRequest | |
52 | when 401 then Error::Unauthorized | |
53 | when 403 then Error::Forbidden | |
54 | when 404 then Error::NotFound | |
55 | when 405 then Error::MethodNotAllowed | |
56 | when 409 then Error::Conflict | |
57 | when 422 then Error::Unprocessable | |
58 | when 500 then Error::InternalServerError | |
59 | when 502 then Error::BadGateway | |
60 | when 503 then Error::ServiceUnavailable | |
61 | end | |
78 | 62 | |
79 | fail error_klass.new(response) if error_klass | |
63 | raise error_klass, response if error_klass | |
80 | 64 | |
81 | 65 | parsed = response.parsed_response |
82 | 66 | parsed.client = self if parsed.respond_to?(:client=) |
86 | 70 | |
87 | 71 | # Sets a base_uri and default_params for requests. |
88 | 72 | # @raise [Error::MissingCredentials] if endpoint not set. |
89 | def set_request_defaults(sudo=nil) | |
73 | def request_defaults(sudo=nil) | |
90 | 74 | self.class.default_params sudo: sudo |
91 | raise Error::MissingCredentials.new("Please set an endpoint to API") unless @endpoint | |
75 | raise Error::MissingCredentials, 'Please set an endpoint to API' unless @endpoint | |
92 | 76 | self.class.default_params.delete(:sudo) if sudo.nil? |
93 | 77 | end |
94 | 78 | |
99 | 83 | # @param [Hash] options A customizable set of options. |
100 | 84 | # @option options [Boolean] :unauthenticated true if the API call does not require user authentication. |
101 | 85 | # @raise [Error::MissingCredentials] if private_token and auth_token are not set. |
102 | def set_authorization_header(options) | |
103 | unless options[:unauthenticated] | |
104 | raise Error::MissingCredentials.new("Please provide a private_token or auth_token for user") unless @private_token | |
105 | if @private_token.length <= 20 | |
106 | options[:headers] = { 'PRIVATE-TOKEN' => @private_token } | |
107 | else | |
108 | options[:headers] = { 'Authorization' => "Bearer #{@private_token}" } | |
109 | end | |
110 | end | |
86 | def authorization_header(options) | |
87 | return if options[:unauthenticated] | |
88 | raise Error::MissingCredentials, 'Please provide a private_token or auth_token for user' unless @private_token | |
89 | ||
90 | options[:headers] = if @private_token.size < 21 | |
91 | { 'PRIVATE-TOKEN' => @private_token } | |
92 | else | |
93 | { 'Authorization' => "Bearer #{@private_token}" } | |
94 | end | |
111 | 95 | end |
112 | 96 | |
113 | 97 | # Set HTTParty configuration |
114 | 98 | # @see https://github.com/jnunemaker/httparty |
115 | def set_httparty_config(options) | |
99 | def httparty_config(options) | |
116 | 100 | options.merge!(httparty) if httparty |
117 | 101 | end |
118 | 102 | end |
62 | 62 | |
63 | 63 | # Execute a given command with arguements |
64 | 64 | def execute(cmd=command, args=arguments) |
65 | if actions.include?(cmd.to_sym) | |
66 | confirm_command(cmd) | |
67 | gitlab_helper(cmd, args) | |
68 | else | |
69 | fail "Unknown command: #{cmd}. " \ | |
70 | "See the 'help' for a list of valid commands." | |
71 | end | |
65 | raise "Unknown command: #{cmd}. See the 'help' for a list of valid commands." unless actions.include?(cmd.to_sym) | |
66 | ||
67 | confirm_command(cmd) | |
68 | gitlab_helper(cmd, args) | |
72 | 69 | end |
73 | 70 | |
74 | 71 | def quit_shell |
79 | 76 | def history |
80 | 77 | @history ||= History.new |
81 | 78 | end |
82 | end # class << self | |
79 | end | |
83 | 80 | end |
25 | 25 | end |
26 | 26 | |
27 | 27 | # Delegate to Gitlab::Client |
28 | def respond_to_missing?(method_name, include_private = false) | |
28 | def self.respond_to_missing?(method_name, include_private=false) | |
29 | 29 | client.respond_to?(method_name) || super |
30 | 30 | end |
31 | 31 | |
38 | 38 | # |
39 | 39 | # @return [Array<Symbol>] |
40 | 40 | def self.actions |
41 | hidden = /endpoint|private_token|auth_token|user_agent|sudo|get|post|put|\Adelete\z|validate|set_request_defaults|httparty/ | |
41 | hidden = /endpoint|private_token|auth_token|user_agent|sudo|get|post|put|\Adelete\z|validate|request_defaults|httparty/ | |
42 | 42 | (Gitlab::Client.instance_methods - Object.methods).reject { |e| e[hidden] } |
43 | 43 | end |
44 | 44 | end |
0 | { "id" : 1, "label" : { "name" : "Testing", "color" : "#F0AD4E", "description" : null }, "position" : 1 } |
0 | [ { "id" : 1, "label" : { "name" : "Testing", "color" : "#F0AD4E", "description" : null }, "position" : 1 }, { "id" : 2, "label" : { "name" : "Ready", "color" : "#FF0000", "description" : null }, "position" : 2 }, { "id" : 3, "label" : { "name" : "Production", "color" : "#FF5F00", "description" : null }, "position" : 3 } ] |
0 | [ { "id" : 1, "lists" : [ { "id" : 1, "label" : { "name" : "Testing", "color" : "#F0AD4E", "description" : null }, "position" : 1 }, { "id" : 2, "label" : { "name" : "Ready", "color" : "#FF0000", "description" : null }, "position" : 2 }, { "id" : 3, "label" : { "name" : "Production", "color" : "#FF5F00", "description" : null }, "position" : 3 } ] } ] |
0 | {"name":"api","commit":{"id":"f7dd067490fe57505f7226c3b54d3127d2f7fd46","parents":[{"id":"949b1df930bedace1dbd755aaa4a82e8c451a616"}],"tree":"f8c4b21c036339f92fcc5482aa28a41250553b27","message":"API: expose issues project id","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-07-25T04:22:21-07:00","committed_date":"2012-07-25T04:22:21-07:00"},"protected": true} |
0 | [{"name":"api","commit":{"id":"f7dd067490fe57505f7226c3b54d3127d2f7fd46","parents":[{"id":"949b1df930bedace1dbd755aaa4a82e8c451a616"}],"tree":"f8c4b21c036339f92fcc5482aa28a41250553b27","message":"API: expose issues project id","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-07-25T04:22:21-07:00","committed_date":"2012-07-25T04:22:21-07:00"}},{"name":"dashboard-feed","commit":{"id":"f8f6ff065eccc6ede4d35ed87a09bb962b84ca25","parents":[{"id":"2cf8010792c3075824ee27d0f037aeb178cbbf7e"}],"tree":"e17f2157143d550891d4669c10b7446e4739bc6d","message":"add projects atom feed","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-05-31T23:42:02-07:00","committed_date":"2012-05-31T23:42:02-07:00"}},{"name":"master","commit":{"id":"2cf8010792c3075824ee27d0f037aeb178cbbf7e","parents":[{"id":"af226ae9c9af406c8a0e0bbdf364563495c2f432"},{"id":"e851cb07762aa464aae10e8b4b28de87c1a6f925"}],"tree":"6c6845838039f01723d91f395a1d2fa1dcc82522","message":"Merge pull request #868 from SaitoWu/bugfix/encoding\n\nBugfix/encoding","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-05-30T00:24:43-07:00","committed_date":"2012-05-30T00:24:43-07:00"}},{"name":"preview_notes","commit":{"id":"3749e0d99ac6bfbc65889b1b7a5310e14e7fe89a","parents":[{"id":"2483181f2c3d4ea7d2c68147b19bc07fc3937b0c"}],"tree":"f8c56161b0d6561568f088df9961362eb1ece88b","message":"pass project_id to notes preview path","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-08-09T23:46:27-07:00","committed_date":"2012-08-09T23:46:27-07:00"}},{"name":"refactoring","commit":{"id":"7c7761099cae83f59fe5780340e100be890847b2","parents":[{"id":"058d80b3363dd4fc4417ca4f60f76119188a2470"}],"tree":"d7d4a94c700dc0e84ee943019213d2358a49c413","message":"fix deprecation warnings","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-05-29T07:16:28-07:00","committed_date":"2012-05-29T07:16:28-07:00"}}] |
0 | { | |
1 | "commit": { | |
2 | "author_email": "admin@example.com", | |
3 | "author_name": "Administrator", | |
4 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
5 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
6 | "message": "Test the CI integration.", | |
7 | "short_id": "0ff3ae19", | |
8 | "title": "Test the CI integration." | |
9 | }, | |
10 | "coverage": null, | |
11 | "created_at": "2015-12-24T15:51:21.880Z", | |
12 | "download_url": null, | |
13 | "finished_at": "2015-12-24T17:54:31.198Z", | |
14 | "id": 8, | |
15 | "name": "rubocop", | |
16 | "ref": "master", | |
17 | "runner": null, | |
18 | "stage": "test", | |
19 | "started_at": "2015-12-24T17:54:30.733Z", | |
20 | "status": "failed", | |
21 | "tag": false, | |
22 | "user": { | |
23 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
24 | "bio": null, | |
25 | "created_at": "2015-12-21T13:14:24.077Z", | |
26 | "id": 1, | |
27 | "is_admin": true, | |
28 | "linkedin": "", | |
29 | "name": "John Smith", | |
30 | "skype": "", | |
31 | "state": "active", | |
32 | "twitter": "", | |
33 | "username": "root", | |
34 | "web_url": "http://gitlab.dev/u/root", | |
35 | "website_url": "" | |
36 | } | |
37 | }⏎ |
0 | { | |
1 | "commit": { | |
2 | "author_email": "admin@example.com", | |
3 | "author_name": "John Smith", | |
4 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
5 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
6 | "message": "Test the CI integration.", | |
7 | "short_id": "0ff3ae19", | |
8 | "title": "Test the CI integration." | |
9 | }, | |
10 | "coverage": null, | |
11 | "created_at": "2016-01-11T10:13:33.506Z", | |
12 | "download_url": null, | |
13 | "finished_at": "2016-01-11T10:14:09.526Z", | |
14 | "id": 69, | |
15 | "name": "rubocop", | |
16 | "ref": "master", | |
17 | "runner": null, | |
18 | "stage": "test", | |
19 | "started_at": null, | |
20 | "status": "canceled", | |
21 | "tag": false, | |
22 | "user": null | |
23 | }⏎ |
0 | { | |
1 | "commit": { | |
2 | "author_email": "admin@example.com", | |
3 | "author_name": "John Smith", | |
4 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
5 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
6 | "message": "Test the CI integration.", | |
7 | "short_id": "0ff3ae19", | |
8 | "title": "Test the CI integration." | |
9 | }, | |
10 | "coverage": null, | |
11 | "download_url": null, | |
12 | "id": 69, | |
13 | "name": "rubocop", | |
14 | "ref": "master", | |
15 | "runner": null, | |
16 | "stage": "test", | |
17 | "created_at": "2016-01-11T10:13:33.506Z", | |
18 | "started_at": "2016-01-11T10:13:33.506Z", | |
19 | "finished_at": "2016-01-11T10:15:10.506Z", | |
20 | "status": "failed", | |
21 | "tag": false, | |
22 | "user": null | |
23 | } |
0 | { | |
1 | "commit": { | |
2 | "author_email": "admin@example.com", | |
3 | "author_name": "John Smith", | |
4 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
5 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
6 | "message": "Test the CI integration.", | |
7 | "short_id": "0ff3ae19", | |
8 | "title": "Test the CI integration." | |
9 | }, | |
10 | "coverage": null, | |
11 | "created_at": "2016-01-11T10:13:33.506Z", | |
12 | "download_url": null, | |
13 | "finished_at": null, | |
14 | "id": 69, | |
15 | "name": "rubocop", | |
16 | "ref": "master", | |
17 | "runner": null, | |
18 | "stage": "test", | |
19 | "started_at": null, | |
20 | "status": "pending", | |
21 | "tag": false, | |
22 | "user": null | |
23 | }⏎ |
0 | [ | |
1 | { | |
2 | "commit": { | |
3 | "author_email": "admin@example.com", | |
4 | "author_name": "Administrator", | |
5 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
6 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
7 | "message": "Test the CI integration.", | |
8 | "short_id": "0ff3ae19", | |
9 | "title": "Test the CI integration." | |
10 | }, | |
11 | "coverage": null, | |
12 | "created_at": "2015-12-24T15:51:21.802Z", | |
13 | "download_url": null, | |
14 | "finished_at": "2015-12-24T17:54:27.895Z", | |
15 | "id": 7, | |
16 | "name": "teaspoon", | |
17 | "ref": "master", | |
18 | "runner": null, | |
19 | "stage": "test", | |
20 | "started_at": "2015-12-24T17:54:27.722Z", | |
21 | "status": "failed", | |
22 | "tag": false, | |
23 | "user": { | |
24 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
25 | "bio": null, | |
26 | "created_at": "2015-12-21T13:14:24.077Z", | |
27 | "id": 1, | |
28 | "is_admin": true, | |
29 | "linkedin": "", | |
30 | "name": "Administrator", | |
31 | "skype": "", | |
32 | "state": "active", | |
33 | "twitter": "", | |
34 | "username": "root", | |
35 | "web_url": "http://gitlab.dev/u/root", | |
36 | "website_url": "" | |
37 | } | |
38 | }, | |
39 | { | |
40 | "commit": { | |
41 | "author_email": "admin@example.com", | |
42 | "author_name": "Administrator", | |
43 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
44 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
45 | "message": "Test the CI integration.", | |
46 | "short_id": "0ff3ae19", | |
47 | "title": "Test the CI integration." | |
48 | }, | |
49 | "coverage": null, | |
50 | "created_at": "2015-12-24T15:51:21.727Z", | |
51 | "download_url": null, | |
52 | "finished_at": "2015-12-24T17:54:24.921Z", | |
53 | "id": 6, | |
54 | "name": "spinach:other", | |
55 | "ref": "master", | |
56 | "runner": null, | |
57 | "stage": "test", | |
58 | "started_at": "2015-12-24T17:54:24.729Z", | |
59 | "status": "failed", | |
60 | "tag": false, | |
61 | "user": { | |
62 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
63 | "bio": null, | |
64 | "created_at": "2015-12-21T13:14:24.077Z", | |
65 | "id": 1, | |
66 | "is_admin": true, | |
67 | "linkedin": "", | |
68 | "name": "Administrator", | |
69 | "skype": "", | |
70 | "state": "active", | |
71 | "twitter": "", | |
72 | "username": "root", | |
73 | "web_url": "http://gitlab.dev/u/root", | |
74 | "website_url": "" | |
75 | } | |
76 | } | |
77 | ]⏎ |
0 | [ | |
1 | { | |
2 | "commit": { | |
3 | "author_email": "admin@example.com", | |
4 | "author_name": "Administrator", | |
5 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
6 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
7 | "message": "Test the CI integration.", | |
8 | "short_id": "0ff3ae19", | |
9 | "title": "Test the CI integration." | |
10 | }, | |
11 | "coverage": null, | |
12 | "created_at": "2016-01-11T10:13:33.506Z", | |
13 | "download_url": null, | |
14 | "finished_at": "2016-01-11T10:14:09.526Z", | |
15 | "id": 69, | |
16 | "name": "rubocop", | |
17 | "ref": "master", | |
18 | "runner": null, | |
19 | "stage": "test", | |
20 | "started_at": null, | |
21 | "status": "canceled", | |
22 | "tag": false, | |
23 | "user": null | |
24 | }, | |
25 | { | |
26 | "commit": { | |
27 | "author_email": "admin@example.com", | |
28 | "author_name": "Administrator", | |
29 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
30 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
31 | "message": "Test the CI integration.", | |
32 | "short_id": "0ff3ae19", | |
33 | "title": "Test the CI integration." | |
34 | }, | |
35 | "coverage": null, | |
36 | "created_at": "2015-12-24T15:51:21.957Z", | |
37 | "download_url": null, | |
38 | "finished_at": "2015-12-24T17:54:33.913Z", | |
39 | "id": 9, | |
40 | "name": "brakeman", | |
41 | "ref": "master", | |
42 | "runner": null, | |
43 | "stage": "test", | |
44 | "started_at": "2015-12-24T17:54:33.727Z", | |
45 | "status": "failed", | |
46 | "tag": false, | |
47 | "user": { | |
48 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
49 | "bio": null, | |
50 | "created_at": "2015-12-21T13:14:24.077Z", | |
51 | "id": 1, | |
52 | "is_admin": true, | |
53 | "linkedin": "", | |
54 | "name": "Administrator", | |
55 | "skype": "", | |
56 | "state": "active", | |
57 | "twitter": "", | |
58 | "username": "root", | |
59 | "web_url": "http://gitlab.dev/u/root", | |
60 | "website_url": "" | |
61 | } | |
62 | } | |
63 | ]⏎ |
0 | ||
1 | { | |
2 | "commit": { | |
3 | "id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1", | |
4 | "short_id": "12d65c8dd2b", | |
5 | "title": "JS fix", | |
6 | "author_name": "Dmitriy Zaporozhets", | |
7 | "author_email": "dmitriy.zaporozhets@gmail.com", | |
8 | "created_at": "2014-02-27T10:27:00+02:00" | |
9 | }, | |
10 | "commits": [{ | |
11 | "id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1", | |
12 | "short_id": "12d65c8dd2b", | |
13 | "title": "JS fix", | |
14 | "author_name": "Dmitriy Zaporozhets", | |
15 | "author_email": "dmitriy.zaporozhets@gmail.com", | |
16 | "created_at": "2014-02-27T10:27:00+02:00" | |
17 | }], | |
18 | "diffs": [{ | |
19 | "old_path": "files/js/application.js", | |
20 | "new_path": "files/js/application.js", | |
21 | "a_mode": null, | |
22 | "b_mode": "100644", | |
23 | "diff": "--- a/files/js/application.js\n+++ b/files/js/application.js\n@@ -24,8 +24,10 @@\n //= require g.raphael-min\n //= require g.bar-min\n //= require branch-graph\n-//= require highlightjs.min\n-//= require ace/ace\n //= require_tree .\n //= require d3\n //= require underscore\n+\n+function fix() { \n+ alert(\"Fixed\")\n+}", | |
24 | "new_file": false, | |
25 | "renamed_file": false, | |
26 | "deleted_file": false | |
27 | }], | |
28 | "compare_timeout": false, | |
29 | "compare_same_ref": false | |
30 | } |
0 | { | |
1 | "id": 12, | |
2 | "name": "staging", | |
3 | "slug": "staging-cb247rv", | |
4 | "external_url": "https://staging.example.gitlab.com" | |
5 | }⏎ |
0 | [ | |
1 | { | |
2 | "id": 1, | |
3 | "name": "review/fix-foo", | |
4 | "slug": "review-fix-foo-dfjre3", | |
5 | "external_url": "https://review-fix-foo-dfjre3.example.gitlab.com" | |
6 | }, | |
7 | { | |
8 | "id": 12, | |
9 | "name": "review/fix-bar", | |
10 | "slug": "review-fix-bar-dbwr18", | |
11 | "external_url": "https://review-fix-bar-dbwr18.example.gitlab.com" | |
12 | } | |
13 | ]⏎ |
0 | {"file_name":"README.md", "file_path":"README.md", "size":"19", "encoding":"base64", "content":"VGhpcyBpcyBhICpSRUFETUUqIQ==\n", "ref":"master", "blob_id":"0eba9dff767611060181e0423a1de2941d27efc8", "commit_id":"eb38397cb6ae669219e6bc18ad19981fff18ea29"} |
0 | {"id": 10, "name": "GitLab-Group", "path": "gitlab-group", "owner_id": 6, "projects": [ | |
1 | { | |
2 | "id": 9, | |
3 | "name": "mojito", | |
4 | "description": null, | |
5 | "default_branch": "master", | |
6 | "owner": { | |
7 | "id": 6, | |
8 | "username": "jose", | |
9 | "email": "jose@abc.com", | |
10 | "name": "Jose Jose", | |
11 | "blocked": false, | |
12 | "created_at": "2013-02-06T06:54:06Z" | |
13 | }, | |
14 | "path": "mojito", | |
15 | "path_with_namespace": "gitlab-group/mojito", | |
16 | "issues_enabled": true, | |
17 | "merge_requests_enabled": true, | |
18 | "wall_enabled": true, | |
19 | "wiki_enabled": true, | |
20 | "created_at": "2013-02-06T16:59:15Z", | |
21 | "namespace": { | |
22 | "created_at": "2013-02-06T16:58:22Z", | |
23 | "id": 10, | |
24 | "name": "GitLab-Group", | |
25 | "owner_id": 6, | |
26 | "path": "gitlab-group", | |
27 | "updated_at": "2013-02-06T16:58:22Z" | |
28 | } | |
29 | }, | |
30 | { | |
31 | "id": 10, | |
32 | "name": "gitlabhq", | |
33 | "description": null, | |
34 | "default_branch": null, | |
35 | "owner": { | |
36 | "id": 6, | |
37 | "username": "randx", | |
38 | "email": "randx@github.com", | |
39 | "name": "Dmitry Z", | |
40 | "blocked": false, | |
41 | "created_at": "2013-02-06T06:54:06Z" | |
42 | }, | |
43 | "path": "gitlabhq", | |
44 | "path_with_namespace": "gitlab-group/gitlabhq", | |
45 | "issues_enabled": true, | |
46 | "merge_requests_enabled": true, | |
47 | "wall_enabled": true, | |
48 | "wiki_enabled": true, | |
49 | "created_at": "2013-02-06T17:02:31Z", | |
50 | "namespace": { | |
51 | "created_at": "2013-02-06T16:58:22Z", | |
52 | "id": 10, | |
53 | "name": "GitLab-Group", | |
54 | "owner_id": 6, | |
55 | "path": "gitlab-group", | |
56 | "updated_at": "2013-02-06T16:58:22Z" | |
57 | } | |
58 | } | |
59 | ]}⏎ |
0 | {"id":3,"name":"Gitlab-Group","path":"gitlab-group","owner_id":1}⏎ |
0 | {"id":3,"name":"Gitlab-Group","path":"gitlab-group","owner_id":1,"description":"gitlab group description"}⏎ |
0 | {"id":42,"name":"Gitlab-Group","path":"gitlab-group","created_at":"2016-02-24T20:16:42.906Z","updated_at":"2016-02-24T20:16:42.906Z"} |
0 | {"id":2,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-09-04T18:15:30Z","access_level":10}⏎ |
0 | {"created_at":"2013-09-04T18:18:15Z","group_access":10,"group_id":3,"id":2,"notification_level":3,"updated_at":"2013-09-04T18:18:15Z","user_id":2}⏎ |
0 | {"id":2,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-09-04T18:15:30Z","access_level":50}⏎ |
0 | [{"id":1,"username":"eraymond","email":"eraymond@local.host","name":"Edward Raymond","state":"active","created_at":"2013-08-30T16:16:22Z","access_level":50},{"id":1,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-08-30T16:16:22Z","access_level":50}]⏎ |
0 | [ | |
1 | { | |
2 | "id": 4, | |
3 | "description": null, | |
4 | "default_branch": "master", | |
5 | "public": false, | |
6 | "visibility_level": 0, | |
7 | "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", | |
8 | "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git", | |
9 | "web_url": "http://example.com/diaspora/diaspora-client", | |
10 | "tag_list": [ | |
11 | "example", | |
12 | "disapora client" | |
13 | ], | |
14 | "owner": { | |
15 | "id": 3, | |
16 | "name": "Diaspora", | |
17 | "created_at": "2013-09-30T13: 46: 02Z" | |
18 | }, | |
19 | "name": "Diaspora Client", | |
20 | "name_with_namespace": "Diaspora / Diaspora Client", | |
21 | "path": "diaspora-client", | |
22 | "path_with_namespace": "diaspora/diaspora-client", | |
23 | "issues_enabled": true, | |
24 | "merge_requests_enabled": true, | |
25 | "builds_enabled": true, | |
26 | "wiki_enabled": true, | |
27 | "snippets_enabled": false, | |
28 | "created_at": "2013-09-30T13: 46: 02Z", | |
29 | "last_activity_at": "2013-09-30T13: 46: 02Z", | |
30 | "creator_id": 3, | |
31 | "namespace": { | |
32 | "created_at": "2013-09-30T13: 46: 02Z", | |
33 | "description": "", | |
34 | "id": 3, | |
35 | "name": "Diaspora", | |
36 | "owner_id": 1, | |
37 | "path": "diaspora", | |
38 | "updated_at": "2013-09-30T13: 46: 02Z" | |
39 | }, | |
40 | "archived": false, | |
41 | "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png" | |
42 | } | |
43 | ] |
0 | [{"id": 5,"name": "Five-Group","path": "five-group","owner_id": 2},{"id": 8,"name": "Eight Group","path": "eight-group","owner_id": 6} | |
1 | ] |
0 | [{"id": 3,"name": "ThreeGroup","path": "threegroup","owner_id": 1},{"id": 5,"name": "Five-Group","path": "five-group","owner_id": 2},{"id": 8,"name": "Eight Group","path": "eight-group","owner_id": 6} | |
1 | ]⏎ |
0 | {"id":33,"project_id":3,"title":"Beatae possimus nostrum nihil reiciendis laboriosam nihil delectus alias accusantium dolor unde.","description":null,"labels":[],"milestone":null,"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}⏎ |
0 | { | |
1 | "id": 4, | |
2 | "name": "blowfish", | |
3 | "user": { | |
4 | "name": "Administrator", | |
5 | "username": "root", | |
6 | "id": 1, | |
7 | "state": "active", | |
8 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
9 | "web_url": "http://gitlab.example.com/root" | |
10 | }, | |
11 | "created_at": "2016-06-15T10:09:34.206Z", | |
12 | "updated_at": "2016-06-15T10:09:34.206Z", | |
13 | "awardable_id": 80, | |
14 | "awardable_type": "Issue" | |
15 | }⏎ |
0 | [ | |
1 | { | |
2 | "id": 4, | |
3 | "name": "1234", | |
4 | "user": { | |
5 | "name": "Administrator", | |
6 | "username": "root", | |
7 | "id": 1, | |
8 | "state": "active", | |
9 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
10 | "web_url": "http://gitlab.example.com/root" | |
11 | }, | |
12 | "created_at": "2016-06-15T10:09:34.206Z", | |
13 | "updated_at": "2016-06-15T10:09:34.206Z", | |
14 | "awardable_id": 80, | |
15 | "awardable_type": "Issue" | |
16 | }, | |
17 | { | |
18 | "id": 1, | |
19 | "name": "microphone", | |
20 | "user": { | |
21 | "name": "User 4", | |
22 | "username": "user4", | |
23 | "id": 26, | |
24 | "state": "active", | |
25 | "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", | |
26 | "web_url": "http://gitlab.example.com/user4" | |
27 | }, | |
28 | "created_at": "2016-06-15T10:09:34.177Z", | |
29 | "updated_at": "2016-06-15T10:09:34.177Z", | |
30 | "awardable_id": 80, | |
31 | "awardable_type": "Issue" | |
32 | } | |
33 | ]⏎ |
0 | [{"id":1,"project_id":1,"title":"Culpa eius recusandae suscipit autem distinctio dolorum.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":6,"project_id":2,"title":"Ut in dolorum omnis sed sit aliquam.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":12,"project_id":3,"title":"Veniam et tempore quidem eum reprehenderit cupiditate non aut velit eaque.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":21,"project_id":1,"title":"Vitae ea aliquam et quo eligendi sapiente voluptatum labore hic nihil culpa.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":26,"project_id":2,"title":"Quo enim est nihil atque placeat voluptas neque eos voluptas.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":32,"project_id":3,"title":"Deserunt tenetur impedit est beatae voluptas voluptas quaerat quisquam.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}]⏎ |
0 | { | |
1 | "commit": { | |
2 | "author_email": "admin@example.com", | |
3 | "author_name": "Administrator", | |
4 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
5 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
6 | "message": "Test the CI integration.", | |
7 | "short_id": "0ff3ae19", | |
8 | "title": "Test the CI integration." | |
9 | }, | |
10 | "coverage": null, | |
11 | "created_at": "2015-12-24T15:51:21.880Z", | |
12 | "artifacts_file": null, | |
13 | "finished_at": "2015-12-24T17:54:31.198Z", | |
14 | "id": 8, | |
15 | "name": "rubocop", | |
16 | "pipeline": { | |
17 | "id": 6, | |
18 | "ref": "master", | |
19 | "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
20 | "status": "pending" | |
21 | }, | |
22 | "ref": "master", | |
23 | "runner": null, | |
24 | "stage": "test", | |
25 | "started_at": "2015-12-24T17:54:30.733Z", | |
26 | "status": "failed", | |
27 | "tag": false, | |
28 | "user": { | |
29 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
30 | "bio": null, | |
31 | "created_at": "2015-12-21T13:14:24.077Z", | |
32 | "id": 1, | |
33 | "linkedin": "", | |
34 | "name": "Administrator", | |
35 | "skype": "", | |
36 | "state": "active", | |
37 | "twitter": "", | |
38 | "username": "root", | |
39 | "web_url": "http://gitlab.dev/root", | |
40 | "website_url": "" | |
41 | } | |
42 | } |
0 | [ | |
1 | { | |
2 | "commit": { | |
3 | "author_email": "admin@example.com", | |
4 | "author_name": "Administrator", | |
5 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
6 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
7 | "message": "Test the CI integration.", | |
8 | "short_id": "0ff3ae19", | |
9 | "title": "Test the CI integration." | |
10 | }, | |
11 | "coverage": null, | |
12 | "created_at": "2015-12-24T15:51:21.802Z", | |
13 | "artifacts_file": { | |
14 | "filename": "artifacts.zip", | |
15 | "size": 1000 | |
16 | }, | |
17 | "finished_at": "2015-12-24T17:54:27.895Z", | |
18 | "id": 7, | |
19 | "name": "teaspoon", | |
20 | "pipeline": { | |
21 | "id": 6, | |
22 | "ref": "master", | |
23 | "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
24 | "status": "pending" | |
25 | }, | |
26 | "ref": "master", | |
27 | "runner": null, | |
28 | "stage": "test", | |
29 | "started_at": "2015-12-24T17:54:27.722Z", | |
30 | "status": "failed", | |
31 | "tag": false, | |
32 | "user": { | |
33 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
34 | "bio": null, | |
35 | "created_at": "2015-12-21T13:14:24.077Z", | |
36 | "id": 1, | |
37 | "linkedin": "", | |
38 | "name": "Administrator", | |
39 | "skype": "", | |
40 | "state": "active", | |
41 | "twitter": "", | |
42 | "username": "root", | |
43 | "web_url": "http://gitlab.dev/root", | |
44 | "website_url": "" | |
45 | } | |
46 | }, | |
47 | { | |
48 | "commit": { | |
49 | "author_email": "admin@example.com", | |
50 | "author_name": "Administrator", | |
51 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
52 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
53 | "message": "Test the CI integration.", | |
54 | "short_id": "0ff3ae19", | |
55 | "title": "Test the CI integration." | |
56 | }, | |
57 | "coverage": null, | |
58 | "created_at": "2015-12-24T15:51:21.727Z", | |
59 | "artifacts_file": null, | |
60 | "finished_at": "2015-12-24T17:54:24.921Z", | |
61 | "id": 6, | |
62 | "name": "spinach:other", | |
63 | "pipeline": { | |
64 | "id": 6, | |
65 | "ref": "master", | |
66 | "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
67 | "status": "pending" | |
68 | }, | |
69 | "ref": "master", | |
70 | "runner": null, | |
71 | "stage": "test", | |
72 | "started_at": "2015-12-24T17:54:24.729Z", | |
73 | "status": "failed", | |
74 | "tag": false, | |
75 | "user": { | |
76 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
77 | "bio": null, | |
78 | "created_at": "2015-12-21T13:14:24.077Z", | |
79 | "id": 1, | |
80 | "linkedin": "", | |
81 | "name": "Administrator", | |
82 | "skype": "", | |
83 | "state": "active", | |
84 | "twitter": "", | |
85 | "username": "root", | |
86 | "web_url": "http://gitlab.dev/root", | |
87 | "website_url": "" | |
88 | } | |
89 | } | |
90 | ] |
0 | {"id":1,"title":"narkoz@helium","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkUsh42Nh1yefGd1jbSELn5XsY8p5Oxmau0/1HqHnjuYOaj5X+kHccFDwtmtg9Ox8ua/+WptNsiE8IUwsD3zKgEjajgwq3gMeeFdxfXwM+tEvHOOMV9meRrgRWGYCToPbT6sR7/YMAYa7cPqWSpx/oZhYfz4XtoMv3ZZT1fZMmx3MY3HwXwW8j+obJyN2K4LN0TFi9RPgWWYn0DCyb9OccmABimt3i74WoJ/OT8r6/7swce8+OSe0Q2wBhyTtvxg2vtUcoek8Af+EZaUMBwSEzEsocOCzwQvjF5XUk5o7dJ8nP8W3RE60JWX57t16eQm7lBmumLYfszpn2isd6W7a1 narkoz@helium"} |
0 | [{"id":1,"title":"narkoz@helium","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkUsh42Nh1yefGd1jbSELn5XsY8p5Oxmau0/1HqHnjuYOaj5X+kHccFDwtmtg9Ox8ua/+WptNsiE8IUwsD3zKgEjajgwq3gMeeFdxfXwM+tEvHOOMV9meRrgRWGYCToPbT6sR7/YMAYa7cPqWSpx/oZhYfz4XtoMv3ZZT1fZMmx3MY3HwXwW8j+obJyN2K4LN0TFi9RPgWWYn0DCyb9OccmABimt3i74WoJ/OT8r6/7swce8+OSe0Q2wBhyTtvxg2vtUcoek8Af+EZaUMBwSEzEsocOCzwQvjF5XUk5o7dJ8nP8W3RE60JWX57t16eQm7lBmumLYfszpn2isd6W7a1 narkoz@helium"}] |
0 | {"name": "Backlog", "color": "#DD10AA", "subscribed": true} |
0 | {"name": "Backlog", "color": "#DD10AA", "subscribed": false} |
0 | [{"name": "Backlog", "color": "#DD10AA"},{"name": "Documentation", "color": "#1E80DD"}] |
0 | {"id":1,"target_branch":"master","source_branch":"api","project_id":3,"title":"New feature","closed":false,"merged":false,"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-10-19T05:56:14Z"}}⏎ |
0 | { | |
1 | "id": 4, | |
2 | "name": "blowfish", | |
3 | "user": { | |
4 | "name": "Administrator", | |
5 | "username": "root", | |
6 | "id": 1, | |
7 | "state": "active", | |
8 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
9 | "web_url": "http://gitlab.example.com/root" | |
10 | }, | |
11 | "created_at": "2016-06-15T10:09:34.206Z", | |
12 | "updated_at": "2016-06-15T10:09:34.206Z", | |
13 | "awardable_id": 80, | |
14 | "awardable_type": "MergeRequest" | |
15 | }⏎ |
0 | [ | |
1 | { | |
2 | "id": 4, | |
3 | "name": "1234", | |
4 | "user": { | |
5 | "name": "Administrator", | |
6 | "username": "root", | |
7 | "id": 1, | |
8 | "state": "active", | |
9 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
10 | "web_url": "http://gitlab.example.com/root" | |
11 | }, | |
12 | "created_at": "2016-06-15T10:09:34.206Z", | |
13 | "updated_at": "2016-06-15T10:09:34.206Z", | |
14 | "awardable_id": 80, | |
15 | "awardable_type": "MergeRequest" | |
16 | }, | |
17 | { | |
18 | "id": 1, | |
19 | "name": "microphone", | |
20 | "user": { | |
21 | "name": "User 4", | |
22 | "username": "user4", | |
23 | "id": 26, | |
24 | "state": "active", | |
25 | "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", | |
26 | "web_url": "http://gitlab.example.com/user4" | |
27 | }, | |
28 | "created_at": "2016-06-15T10:09:34.177Z", | |
29 | "updated_at": "2016-06-15T10:09:34.177Z", | |
30 | "awardable_id": 80, | |
31 | "awardable_type": "MergeRequest" | |
32 | } | |
33 | ]⏎ |
0 | {"id":2,"iid":5,"project_id":3,"title":"Uncovered","description":"","state":"opened","created_at":"2015-03-15T23:15:13.292+01:00","updated_at":"2015-03-15T23:15:14.132+01:00","target_branch":"master","source_branch":"uncovered","upvotes":0,"downvotes":0,"author":{"name":"Dominik Sander","username":"dsander","id":1,"state":"active","avatar_url":"https://secure.gravatar.com/avatar/7f01734389dd6730d076ddee04838bd3?s=40\u0026d=identicon"},"assignee":null,"source_project_id":6,"target_project_id":6,"labels":[],"milestone":null,"changes":[{"old_path":"lib/omniauth/builder.rb","new_path":"lib/omniauth/builder.rb","a_mode":"100644","b_mode":"100644","diff":"--- a/lib/omniauth/builder.rb\n+++ b/lib/omniauth/builder.rb\n@@ -7,11 +7,13 @@ module OmniAuth\n else\n @app = app\n super(\u0026block)\n+ two = 1 # woah! uncovered\n @ins \u003c\u003c @app\n end\n end\n \n def rack14?\n+ one = 2 # thats oke!\n Rack.release.split('.')[1].to_i \u003e= 4\n end\n ","new_file":false,"renamed_file":false,"deleted_file":false}]}⏎ |
0 | [{"id":1,"iid":1,"project_id":5,"title":"Merge request 1 issue 1","description":"","state":"opened","created_at":"2017-04-06T08:03:36.163Z","updated_at":"2017-04-06T08:03:57.087Z","labels":[],"milestone":null,"assignee":null,"author":{"name":"John","username":"jdoe","id":1,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoe"},"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/issues/1"},{"id":2,"iid":2,"project_id":5,"title":"Merge request 1 issue 2","description":"","state":"opened","created_at":"2017-04-06T08:03:44.023Z","updated_at":"2017-04-06T08:03:44.023Z","labels":[],"milestone":null,"assignee":null,"author":{"name":"John","username":"jdoe","id":426047,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoe"},"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/issues/2"}] |
0 | {"note":"Cool Merge Request!","author":{"id":1,"username":"jsmith","email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-07-11T01:32:18Z"}}⏎ |
0 | [{"note":"this is the 1st comment on the 2merge merge request","author":{"id":11,"username":"admin","email":"admin@example.com","name":"A User","state":"active","created_at":"2014-03-06T08:17:35.000Z"}},{"note":"another discussion point on the 2merge request","author":{"id":12,"username":"admin","email":"admin@example.com","name":"A User","state":"active","created_at":"2014-03-06T08:17:35.000Z"}}] |
0 | [{"id":"a2da7552f26d5b46a6a09bb8b7b066e3a102be7d","short_id":"a2da7552","title": "piyo","author_name":"example","author_email":"example@example.com","created_at":"2015-12-19T18:02:31.000+09:00","message":"fuga"},{"id":"3ce509590f37dbce5b877c3e1c78bd3903493170","short_id":"3ce50959","title":"hoge","author_name":"example","author_email":"example@example.com","created_at":"2015-12-19T17:53:46.000+09:00","message":"Hoge"}] |
0 | [{"id":1,"target_branch":"master","source_branch":"api","project_id":3,"title":"New feature","closed":false,"merged":false,"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-10-19T05:56:14Z"}}] |
0 | {"id":1,"project_id":3,"title":"3.0","description":"","due_date":"2012-10-22","closed":false,"updated_at":"2012-09-17T10:15:31Z","created_at":"2012-09-17T10:15:31Z"}⏎ |
0 | [{"id":1,"project_id":3,"title":"Culpa eius recusandae suscipit autem distinctio dolorum.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":6,"project_id":3,"title":"Ut in dolorum omnis sed sit aliquam.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":12,"project_id":3,"title":"Veniam et tempore quidem eum reprehenderit cupiditate non aut velit eaque.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":21,"project_id":3,"title":"Vitae ea aliquam et quo eligendi sapiente voluptatum labore hic nihil culpa.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":26,"project_id":3,"title":"Quo enim est nihil atque placeat voluptas neque eos voluptas.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":32,"project_id":3,"title":"Deserunt tenetur impedit est beatae voluptas voluptas quaerat quisquam.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}]⏎ |
0 | [{"id":1,"iid":1,"project_id":1,"title":"lorem ipsum","description":"","state":"opened","created_at":"2017-03-24T12:23:53.918Z","updated_at":"2017-03-24T12:23:53.918Z","target_branch":"master","source_branch":"def","upvotes":0,"downvotes":0,"author":{"name":"John Doe","username":"jdoe","id":1,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoen"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":{"id":1,"iid":1,"project_id":1,"title":"Test","description":"","state":"active","created_at":"2017-03-24T12:23:00.560Z","updated_at":"2017-03-24T12:23:00.560Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"aec123d1775790b2347fdd684b5ba613fdeb994b","merge_commit_sha":null,"user_notes_count":0,"approvals_before_merge":null,"should_remove_source_branch":null,"force_remove_source_branch":false,"squash":false,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/merge_requests/2"},{"id":2,"iid":2,"project_id":1,"title":"ipsum lorem","description":"","state":"opened","created_at":"2017-03-24T12:23:24.662Z","updated_at":"2017-03-24T12:23:33.522Z","target_branch":"master","source_branch":"test1","upvotes":0,"downvotes":0,"author":{"name":"Joren","username":"jdoe","id":1,"state":"active","":"","web_url":"https://gitlab.com/jdoe"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":{"id":1,"iid":1,"project_id":1,"title":"Test","description":"","state":"active","created_at":"2017-03-24T12:23:00.560Z","updated_at":"2017-03-24T12:23:00.560Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"3ee44c9b40deddae596f838b97523c6f010fd80d","merge_commit_sha":null,"user_notes_count":0,"approvals_before_merge":null,"should_remove_source_branch":null,"force_remove_source_branch":true,"squash":false,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/merge_requests/1"}] |
0 | [{"id":1,"project_id":3,"title":"3.0","description":"","due_date":"2012-10-22","closed":false,"updated_at":"2012-09-17T10:15:31Z","created_at":"2012-09-17T10:15:31Z"}]⏎ |
0 | {"id":1201,"body":"The solution is rather tricky","author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"created_at":"2012-11-27T19:16:44Z"} |
0 | { | |
1 | "id": 4, | |
2 | "name": "mood_bubble_lightning", | |
3 | "user": { | |
4 | "name": "User 4", | |
5 | "username": "user4", | |
6 | "id": 26, | |
7 | "state": "active", | |
8 | "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", | |
9 | "web_url": "http://gitlab.example.com/user4" | |
10 | }, | |
11 | "created_at": "2016-06-15T10:09:34.197Z", | |
12 | "updated_at": "2016-06-15T10:09:34.197Z", | |
13 | "awardable_id": 1, | |
14 | "awardable_type": "Note" | |
15 | } |
0 | [ | |
1 | { | |
2 | "id": 2, | |
3 | "name": "mood_bubble_lightning", | |
4 | "user": { | |
5 | "name": "User 4", | |
6 | "username": "user4", | |
7 | "id": 26, | |
8 | "state": "active", | |
9 | "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", | |
10 | "web_url": "http://gitlab.example.com/user4" | |
11 | }, | |
12 | "created_at": "2016-06-15T10:09:34.197Z", | |
13 | "updated_at": "2016-06-15T10:09:34.197Z", | |
14 | "awardable_id": 1, | |
15 | "awardable_type": "Note" | |
16 | } | |
17 | ]⏎ |
0 | [{"id":1201,"body":"The solution is rather tricky","author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"created_at":"2012-11-27T19:16:44Z"},{"id":1207,"body":"I know, right?","author":{"id":1,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"created_at":"2012-11-27T19:58:21Z"}] |
0 | { | |
1 | "id": 46, | |
2 | "status": "success", | |
3 | "ref": "master", | |
4 | "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", | |
5 | "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", | |
6 | "tag": false, | |
7 | "yaml_errors": null, | |
8 | "user": { | |
9 | "name": "Administrator", | |
10 | "username": "root", | |
11 | "id": 1, | |
12 | "state": "active", | |
13 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
14 | "web_url": "http://localhost:3000/root" | |
15 | }, | |
16 | "created_at": "2016-08-11T11:28:34.085Z", | |
17 | "updated_at": "2016-08-11T11:32:35.169Z", | |
18 | "started_at": null, | |
19 | "finished_at": "2016-08-11T11:32:35.145Z", | |
20 | "committed_at": null, | |
21 | "duration": null | |
22 | }⏎ |
0 | { | |
1 | "id": 46, | |
2 | "status": "canceled", | |
3 | "ref": "master", | |
4 | "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", | |
5 | "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", | |
6 | "tag": false, | |
7 | "yaml_errors": null, | |
8 | "user": { | |
9 | "name": "Administrator", | |
10 | "username": "root", | |
11 | "id": 1, | |
12 | "state": "active", | |
13 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
14 | "web_url": "http://localhost:3000/root" | |
15 | }, | |
16 | "created_at": "2016-08-11T11:28:34.085Z", | |
17 | "updated_at": "2016-08-11T11:32:35.169Z", | |
18 | "started_at": null, | |
19 | "finished_at": "2016-08-11T11:32:35.145Z", | |
20 | "committed_at": null, | |
21 | "duration": null | |
22 | }⏎ |
0 | { | |
1 | "id": 61, | |
2 | "sha": "384c444e840a515b23f21915ee5766b87068a70d", | |
3 | "ref": "master", | |
4 | "status": "pending", | |
5 | "before_sha": "0000000000000000000000000000000000000000", | |
6 | "tag": false, | |
7 | "yaml_errors": null, | |
8 | "user": { | |
9 | "name": "Administrator", | |
10 | "username": "root", | |
11 | "id": 1, | |
12 | "state": "active", | |
13 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
14 | "web_url": "http://localhost:3000/root" | |
15 | }, | |
16 | "created_at": "2016-11-04T09:36:13.747Z", | |
17 | "updated_at": "2016-11-04T09:36:13.977Z", | |
18 | "started_at": null, | |
19 | "finished_at": null, | |
20 | "committed_at": null, | |
21 | "duration": null | |
22 | }⏎ |
0 | [ | |
1 | { | |
2 | "commit": { | |
3 | "author_email": "admin@example.com", | |
4 | "author_name": "Administrator", | |
5 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
6 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
7 | "message": "Test the CI integration.", | |
8 | "short_id": "0ff3ae19", | |
9 | "title": "Test the CI integration." | |
10 | }, | |
11 | "coverage": null, | |
12 | "created_at": "2015-12-24T15:51:21.802Z", | |
13 | "artifacts_file": { | |
14 | "filename": "artifacts.zip", | |
15 | "size": 1000 | |
16 | }, | |
17 | "finished_at": "2015-12-24T17:54:27.895Z", | |
18 | "id": 7, | |
19 | "name": "teaspoon", | |
20 | "pipeline": { | |
21 | "id": 6, | |
22 | "ref": "master", | |
23 | "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
24 | "status": "pending" | |
25 | }, | |
26 | "ref": "master", | |
27 | "runner": null, | |
28 | "stage": "test", | |
29 | "started_at": "2015-12-24T17:54:27.722Z", | |
30 | "status": "failed", | |
31 | "tag": false, | |
32 | "user": { | |
33 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
34 | "bio": null, | |
35 | "created_at": "2015-12-21T13:14:24.077Z", | |
36 | "id": 1, | |
37 | "linkedin": "", | |
38 | "name": "Administrator", | |
39 | "skype": "", | |
40 | "state": "active", | |
41 | "twitter": "", | |
42 | "username": "root", | |
43 | "web_url": "http://gitlab.dev/root", | |
44 | "website_url": "" | |
45 | } | |
46 | }, | |
47 | { | |
48 | "commit": { | |
49 | "author_email": "admin@example.com", | |
50 | "author_name": "Administrator", | |
51 | "created_at": "2015-12-24T16:51:14.000+01:00", | |
52 | "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
53 | "message": "Test the CI integration.", | |
54 | "short_id": "0ff3ae19", | |
55 | "title": "Test the CI integration." | |
56 | }, | |
57 | "coverage": null, | |
58 | "created_at": "2015-12-24T15:51:21.727Z", | |
59 | "artifacts_file": null, | |
60 | "finished_at": "2015-12-24T17:54:24.921Z", | |
61 | "id": 6, | |
62 | "name": "spinach:other", | |
63 | "pipeline": { | |
64 | "id": 6, | |
65 | "ref": "master", | |
66 | "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", | |
67 | "status": "pending" | |
68 | }, | |
69 | "ref": "master", | |
70 | "runner": null, | |
71 | "stage": "test", | |
72 | "started_at": "2015-12-24T17:54:24.729Z", | |
73 | "status": "failed", | |
74 | "tag": false, | |
75 | "user": { | |
76 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
77 | "bio": null, | |
78 | "created_at": "2015-12-21T13:14:24.077Z", | |
79 | "id": 1, | |
80 | "linkedin": "", | |
81 | "name": "Administrator", | |
82 | "skype": "", | |
83 | "state": "active", | |
84 | "twitter": "", | |
85 | "username": "root", | |
86 | "web_url": "http://gitlab.dev/root", | |
87 | "website_url": "" | |
88 | } | |
89 | } | |
90 | ] |
0 | { | |
1 | "id": 46, | |
2 | "status": "pending", | |
3 | "ref": "master", | |
4 | "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", | |
5 | "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", | |
6 | "tag": false, | |
7 | "yaml_errors": null, | |
8 | "user": { | |
9 | "name": "Administrator", | |
10 | "username": "root", | |
11 | "id": 1, | |
12 | "state": "active", | |
13 | "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", | |
14 | "web_url": "http://localhost:3000/root" | |
15 | }, | |
16 | "created_at": "2016-08-11T11:28:34.085Z", | |
17 | "updated_at": "2016-08-11T11:32:35.169Z", | |
18 | "started_at": null, | |
19 | "finished_at": "2016-08-11T11:32:35.145Z", |