Edits history of script submission #23570 for ' Get Folder (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
    })
    
    export type DynSelect_name = string
    
    export async function name() {
      const names = await wmill.FolderService.listFolderNames({
        workspace: wmill.getWorkspace(),
      })
      return names.map((n) => ({ value: n, label: n }))
    }
    
    /**
     * Get Folder
     * Get a folder by name: its admins (`owners`) and the read/write grants of other users and groups (`extra_perms`).
     */
    export async function main(name: DynSelect_name) {
      return await wmill.FolderService.getFolder({
        workspace: wmill.getWorkspace(),
        name,
      })
    }
    

    Submitted by hugo989 5 hours ago