Files
auto-solution/modeler/src/views/decision/algorithm/api.ts

32 lines
1.0 KiB
TypeScript
Raw Normal View History

2026-02-09 19:53:17 +08:00
/*
* This file is part of the kernelstudio package.
*
* (c) 2014-2026 zlin <admin@kernelstudio.com>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/
import { HttpRequestClient } from '@/utils/request';
import type { Algorithm, AlgorithmPageableResponse, AlgorithmRequest } from './types';
import type { BasicResponse } from '@/types';
const req = HttpRequestClient.create<BasicResponse>({
baseURL: '/api',
});
export const findAlgorithmsByQuery = (query: Partial<AlgorithmRequest> = {}): Promise<AlgorithmPageableResponse> => {
return req.get('/algo/algorithm/list', query);
};
export const createAlgorithm = (algorithm: Algorithm): Promise<BasicResponse> => {
return req.postJson('/algo/algorithm', algorithm);
};
export const updateAlgorithm = (algorithm: Algorithm): Promise<BasicResponse> => {
return req.putJson('/algo/algorithm', algorithm);
};
export const deleteAlgorithm = (id: number): Promise<BasicResponse> => {
return req.delete(`/algo/algorithm/${id}`);
};