Files
orion-visor/orion-visor-ui/src/api/terminal/command-snippet.ts

69 lines
1.5 KiB
TypeScript
Raw Normal View History

2024-01-24 19:19:26 +08:00
import type { CommandSnippetGroupQueryResponse } from './command-snippet-group';
import axios from 'axios';
/**
*
*/
export interface CommandSnippetCreateRequest {
groupId?: number;
name?: string;
command?: string;
}
/**
*
*/
export interface CommandSnippetUpdateRequest extends CommandSnippetCreateRequest {
id?: number;
}
/**
*
*/
2024-01-24 22:40:00 +08:00
export interface CommandSnippetQueryResponse extends CommandSnippetQueryResponseExtra {
2024-01-24 19:19:26 +08:00
id: number;
groupId: number;
name: string;
command: string;
2024-01-24 22:40:00 +08:00
}
export interface CommandSnippetQueryResponseExtra {
visible: boolean;
2024-01-24 19:19:26 +08:00
}
/**
*
*/
export interface CommandSnippetWrapperResponse {
groups: Array<CommandSnippetGroupQueryResponse>;
2024-01-24 22:40:00 +08:00
ungroupedItems: Array<CommandSnippetQueryResponse>;
2024-01-24 19:19:26 +08:00
}
/**
*
*/
export function createCommandSnippet(request: CommandSnippetCreateRequest) {
2025-06-25 14:49:36 +08:00
return axios.post('/terminal/command-snippet/create', request);
2024-01-24 19:19:26 +08:00
}
/**
*
*/
export function updateCommandSnippet(request: CommandSnippetUpdateRequest) {
2025-06-25 14:49:36 +08:00
return axios.put('/terminal/command-snippet/update', request);
2024-01-24 19:19:26 +08:00
}
/**
*
*/
export function getCommandSnippetList() {
2025-06-25 14:49:36 +08:00
return axios.get<CommandSnippetWrapperResponse>('/terminal/command-snippet/list');
2024-01-24 19:19:26 +08:00
}
/**
*
*/
export function deleteCommandSnippet(id: number) {
2025-06-25 14:49:36 +08:00
return axios.delete('/terminal/command-snippet/delete', { params: { id } });
2024-01-24 19:19:26 +08:00
}