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