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);
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-09 20:10:24 +08:00
|
|
|
export const runAlgorithm = (algorithm: Algorithm): Promise<BasicResponse> => {
|
|
|
|
|
return req.postJson('/algo/algorithm/run', algorithm);
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-09 19:53:17 +08:00
|
|
|
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}`);
|
|
|
|
|
};
|