Add possibility to choose between version v3 or v4 for the gitlab api.

Apart from the uri versioning, one big change is the snippet visibility post data (visibility_level -> visibility)

Default gitlab api version to v4

Signed-off-by: Cédric Couralet <cedric.couralet@gmail.com>
This commit is contained in:
Cédric Couralet
2018-07-30 13:47:09 +00:00
parent 93a3ce1164
commit 66d374b128
6 changed files with 24 additions and 9 deletions

View File

@@ -573,11 +573,11 @@ function gitlabActionProjects (req, res, note) {
}
}).then(function (user) {
if (!user) { return response.errorNotFound(res) }
var ret = { baseURL: config.gitlab.baseURL }
var ret = { baseURL: config.gitlab.baseURL, version: config.gitlab.version }
ret.accesstoken = user.accessToken
ret.profileid = user.profileid
request(
config.gitlab.baseURL + '/api/v3/projects?access_token=' + user.accessToken,
config.gitlab.baseURL + '/api/' + config.gitlab.version + '/projects?access_token=' + user.accessToken,
function (error, httpResponse, body) {
if (!error && httpResponse.statusCode === 200) {
ret.projects = JSON.parse(body)