0

List Variables

by
Published 6 days ago

List the workspace's variables with their metadata, optionally filtered by path prefix. Secret values are not returned.

Script windmill Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 7 days ago
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
/**
14
 * List Variables
15
 * List the workspace's variables with their metadata, optionally filtered by path prefix. Secret values are not returned.
16
 */
17
export async function main(
18
  path_start: string | undefined,
19
  page: number | undefined,
20
  per_page: number | undefined
21
) {
22
  return await wmill.VariableService.listVariable({
23
    workspace: wmill.getWorkspace(),
24
    pathStart: path_start || undefined,
25
    page: page ?? undefined,
26
    perPage: per_page ?? undefined,
27
  })
28
}
29