diff options
Diffstat (limited to 'app/assets/javascripts/api.js')
-rw-r--r-- | app/assets/javascripts/api.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 797eaf629bf..75f7fe62a7e 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -47,6 +47,7 @@ const Api = { adminStatisticsPath: '/api/:version/application/statistics', pipelineSinglePath: '/api/:version/projects/:id/pipelines/:pipeline_id', environmentsPath: '/api/:version/projects/:id/environments', + rawFilePath: '/api/:version/projects/:id/repository/files/:path/raw', group(groupId, callback) { const url = Api.buildUrl(Api.groupPath).replace(':id', groupId); @@ -497,6 +498,14 @@ const Api = { return axios.get(url); }, + getRawFile(id, path, params = { ref: 'master' }) { + const url = Api.buildUrl(this.rawFilePath) + .replace(':id', encodeURIComponent(id)) + .replace(':path', encodeURIComponent(path)); + + return axios.get(url, { params }); + }, + buildUrl(url) { return joinPaths(gon.relative_url_root || '', url.replace(':version', gon.api_version)); }, |