diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/assets/javascripts/api.js | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/assets/javascripts/api.js')
-rw-r--r-- | app/assets/javascripts/api.js | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index e527659a939..94d155840ea 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -38,6 +38,7 @@ const Api = { userPostStatusPath: '/api/:version/user/status', commitPath: '/api/:version/projects/:id/repository/commits', applySuggestionPath: '/api/:version/suggestions/:id/apply', + applySuggestionBatchPath: '/api/:version/suggestions/batch_apply', commitPipelinesPath: '/:project_id/commit/:sha/pipelines', branchSinglePath: '/api/:version/projects/:id/repository/branches/:branch', createBranchPath: '/api/:version/projects/:id/repository/branches', @@ -51,8 +52,10 @@ const Api = { pipelinesPath: '/api/:version/projects/:id/pipelines/', environmentsPath: '/api/:version/projects/:id/environments', rawFilePath: '/api/:version/projects/:id/repository/files/:path/raw', + issuePath: '/api/:version/projects/:id/issues/:issue_iid', + tagsPath: '/api/:version/projects/:id/repository/tags', - group(groupId, callback) { + group(groupId, callback = () => {}) { const url = Api.buildUrl(Api.groupPath).replace(':id', groupId); return axios.get(url).then(({ data }) => { callback(data); @@ -321,6 +324,12 @@ const Api = { return axios.put(url); }, + applySuggestionBatch(ids) { + const url = Api.buildUrl(Api.applySuggestionBatchPath); + + return axios.put(url, { ids }); + }, + commitPipelines(projectId, sha) { const encodedProjectId = projectId .split('/') @@ -540,6 +549,34 @@ const Api = { return axios.get(url, { params }); }, + updateIssue(project, issue, data = {}) { + const url = Api.buildUrl(Api.issuePath) + .replace(':id', encodeURIComponent(project)) + .replace(':issue_iid', encodeURIComponent(issue)); + + return axios.put(url, data); + }, + + updateMergeRequest(project, mergeRequest, data = {}) { + const url = Api.buildUrl(Api.projectMergeRequestPath) + .replace(':id', encodeURIComponent(project)) + .replace(':mrid', encodeURIComponent(mergeRequest)); + + return axios.put(url, data); + }, + + tags(id, query = '', options = {}) { + const url = Api.buildUrl(this.tagsPath).replace(':id', encodeURIComponent(id)); + + return axios.get(url, { + params: { + search: query, + per_page: DEFAULT_PER_PAGE, + ...options, + }, + }); + }, + buildUrl(url) { return joinPaths(gon.relative_url_root || '', url.replace(':version', gon.api_version)); }, |