forgeplus-react/src/forge/DevOps/cardList/api.js

40 lines
1.2 KiB
JavaScript

import axios from 'axios';
export async function addPipelines(owner, repo, data) {
const res = await axios.post(`/v1/${ owner }/${ repo }/pipelines`, data);
return res.data;
}
export async function getCardList(owner, repo, params) {
const res = await axios.get(`/v1/${owner}/${repo}/pipelines`, { params });
return res.data;
}
export async function getTemplateList() {
const res = await axios.get(`/action/templates.json`);
return res.data;
}
export async function getProjectBranch(owner, repo) {
const res = await axios.get(`/${ owner }/${ repo }/branches.json`);
return res.data;
}
export async function runPipeline(owner, repo, params) {
const res = await axios.get(`/v1/${ owner }/${ repo }/actions/runs.json`, { params });
return res.data;
}
export async function delPipelines(owner, repo, id) {
const res = await axios.delete(`/v1/${ owner }/${ repo }/pipelines/${ id }.json`);
return res.data;
}
export async function stopPipelines(owner, repo, data) {
const res = await axios.post(`/v1/${ owner }/${ repo }/actions/disable.json`, data);
return res.data;
}
export async function startPipelines(owner, repo, data) {
const res = await axios.post(`/v1/${ owner }/${ repo }/actions/enable.json`, data);
return res.data;
}