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

53 lines
1.7 KiB
TypeScript
Raw Normal View History

2026-02-08 15:59:14 +08:00
/*
* This file is part of the kernelstudio package.
*
* (c) 2014-2025 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';
2026-02-08 17:11:03 +08:00
import type { BehaviorTree, BehaviorTreeDetailsResponse, BehaviorTreePageResponse, NodeTemplatesResponse } from './types';
2026-02-08 16:44:50 +08:00
import type { BasicResponse } from '@/types';
2026-02-08 15:59:14 +08:00
const req = HttpRequestClient.create<BasicResponse>({
2026-02-08 16:44:50 +08:00
baseURL: '/api',
2026-02-08 15:59:14 +08:00
});
2026-02-08 16:44:50 +08:00
export const findNodeTemplates = (): Promise<NodeTemplatesResponse> => {
return req.get('/system/nodetemplate/listAll');
2026-02-08 15:59:14 +08:00
};
2026-02-08 16:44:50 +08:00
export const findTreesByQuery = (query: Partial<BehaviorTree> = {}): Promise<BehaviorTreePageResponse> => {
return req.get<BehaviorTreePageResponse>('/system/behaviortree/list', query);
2026-02-08 15:59:14 +08:00
};
2026-02-08 16:44:50 +08:00
export const findOneTreeById = (id: number): Promise<BehaviorTreeDetailsResponse> => {
return req.get(`/system/behaviortree/${id}`);
2026-02-08 15:59:14 +08:00
};
2026-02-08 17:11:03 +08:00
export const updateTree = (rt: Partial<BehaviorTree>): Promise<BasicResponse> => {
return req.postJson('/system/behaviortree/${id}', rt);
2026-02-08 15:59:14 +08:00
};
2026-02-08 17:11:03 +08:00
export const createTree = (rt: Partial<BehaviorTree>): Promise<BasicResponse> => {
return req.putJson('/system/behaviortree/${id}', rt);
2026-02-08 15:59:14 +08:00
};
// export const findOneTreeById = (id: number): Promise<TreeModelDetailsResponse> => {
// return req.postJson(`/tree-details`,{
// tree_id: id
// });
// };
//
// export const updateTree = (rt: Partial<TreeModelGraph>): Promise<BasicResponse> => {
// return req.postJson('/update-tree', rt);
// };
//
// export const createTree = (rt: Partial<TreeModelGraph>): Promise<BasicResponse> => {
// return req.postJson('/update-tree', rt);
// };