Edits history of script submission #23593 for ' List Variables (windmill)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    import * as wmill from "windmill-client"
    
    // windmill-client errors only carry the status text: throw the response body, which says why
    wmill.OpenAPI.interceptors.response.use(async (response) => {
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
      return response
    })
    
    /**
     * List Variables
     * List the workspace's variables with their metadata, optionally filtered by path prefix. Secret values are not returned.
     */
    export async function main(
      path_start: string | undefined,
      page: number | undefined,
      per_page: number | undefined
    ) {
      return await wmill.VariableService.listVariable({
        workspace: wmill.getWorkspace(),
        pathStart: path_start || undefined,
        page: page ?? undefined,
        perPage: per_page ?? undefined,
      })
    }
    

    Submitted by hugo989 5 hours ago