//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
})
/**
* Archive or Unarchive Flow
* Archive a flow by path, or bring an archived one back. Its past runs are kept either way.
*/
export async function main(
path: string,
action: "archive" | "unarchive" = "archive"
) {
return await wmill.FlowService.archiveFlowByPath({
workspace: wmill.getWorkspace(),
path,
requestBody: { archived: action !== "unarchive" },
})
}
Submitted by hugo989 5 hours ago