Initial commit
This commit is contained in:
51
modeler/src/views/decision/api.ts
Normal file
51
modeler/src/views/decision/api.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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';
|
||||
import type { NodeTemplateQuery, NodeTemplatesResponse, TreeModelDetailsResponse, TreeModelGraph, TreeModelsResponse } from './types';
|
||||
import type { ApiPaginationQuery, BasicResponse } from '@/types';
|
||||
|
||||
const req = HttpRequestClient.create<BasicResponse>({
|
||||
baseURL: '/api',
|
||||
});
|
||||
|
||||
export const findTemplatesByQuery = (query: Partial<NodeTemplateQuery>): Promise<NodeTemplatesResponse> => {
|
||||
return req.postJson('/node-templates', query);
|
||||
};
|
||||
|
||||
export const findTreesByQuery = (query: Partial<ApiPaginationQuery>): Promise<TreeModelsResponse> => {
|
||||
return req.get<TreeModelsResponse>('/system/behaviortree/list', query);
|
||||
};
|
||||
|
||||
export const findOneTreeById = (id: number): Promise<TreeModelDetailsResponse> => {
|
||||
return req.get(`/behavior-trees/${id}`);
|
||||
};
|
||||
|
||||
export const updateTree = (rt: Partial<TreeModelGraph>): Promise<BasicResponse> => {
|
||||
return req.postJson('/behavior-trees', rt);
|
||||
};
|
||||
|
||||
export const createTree = (rt: Partial<TreeModelGraph>): Promise<BasicResponse> => {
|
||||
return req.putJson('/behavior-trees', rt);
|
||||
};
|
||||
|
||||
|
||||
// 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);
|
||||
// };
|
||||
Reference in New Issue
Block a user