2018-05-14 17:29:21 +00:00
|
|
|
import axios from '~/lib/utils/axios_utils';
|
2016-11-03 21:38:54 +00:00
|
|
|
|
2017-03-14 00:58:26 +00:00
|
|
|
export default class EnvironmentsService {
|
2017-02-09 11:38:59 +00:00
|
|
|
constructor(endpoint) {
|
2018-05-14 17:29:21 +00:00
|
|
|
this.environmentsEndpoint = endpoint;
|
2017-03-29 11:52:17 +00:00
|
|
|
this.folderResults = 3;
|
2016-10-14 12:14:18 +00:00
|
|
|
}
|
2016-10-26 15:00:16 +00:00
|
|
|
|
2018-05-17 08:45:43 +00:00
|
|
|
fetchEnvironments(options = {}) {
|
2019-01-16 20:05:19 +00:00
|
|
|
const { scope, page, nested } = options;
|
|
|
|
return axios.get(this.environmentsEndpoint, { params: { scope, page, nested } });
|
2016-10-14 12:14:18 +00:00
|
|
|
}
|
2016-12-14 06:51:53 +00:00
|
|
|
|
2018-05-14 17:29:21 +00:00
|
|
|
// eslint-disable-next-line class-methods-use-this
|
2017-03-14 00:58:26 +00:00
|
|
|
postAction(endpoint) {
|
2018-07-10 08:11:04 +00:00
|
|
|
return axios.post(endpoint, {});
|
2017-03-14 00:58:26 +00:00
|
|
|
}
|
2017-03-27 16:37:26 +00:00
|
|
|
|
2020-03-25 09:08:11 +00:00
|
|
|
// eslint-disable-next-line class-methods-use-this
|
|
|
|
deleteAction(endpoint) {
|
|
|
|
return axios.delete(endpoint, {});
|
|
|
|
}
|
|
|
|
|
2017-03-28 10:56:24 +00:00
|
|
|
getFolderContent(folderUrl) {
|
2018-05-14 17:29:21 +00:00
|
|
|
return axios.get(`${folderUrl}.json?per_page=${this.folderResults}`);
|
2017-03-27 16:37:26 +00:00
|
|
|
}
|
2017-03-14 00:58:26 +00:00
|
|
|
}
|