Edits history of script submission #23573 for ' Get Job Logs (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
    })
    
    /**
     * Get Job Logs
     * Get the logs of a job as plain text.
     */
    export async function main(id: string) {
      return await wmill.JobService.getJobLogs({
        workspace: wmill.getWorkspace(),
        id,
      })
    }
    

    Submitted by hugo989 5 hours ago