Delete a variable by path.
1
//native
2
3
import * as wmill from "windmill-client"
4
5
// windmill-client errors only carry the status text: throw the response body, which says why
6
wmill.OpenAPI.interceptors.response.use(async (response) => {
7
if (!response.ok) {
8
throw new Error(`${response.status} ${await response.text()}`)
9
}
10
return response
11
})
12
13
export type DynSelect_path = string
14
15
export async function path() {
16
const variables = await wmill.VariableService.listVariable({
17
workspace: wmill.getWorkspace(),
18
perPage: 1000,
19
20
return variables.map((v) => ({ value: v.path, label: v.path }))
21
22
23
/**
24
* Delete Variable
25
* Delete a variable by path.
26
*/
27
export async function main(path: DynSelect_path) {
28
return await wmill.VariableService.deleteVariable({
29
30
path,
31
32
33