| 1 | 
 | 
 | 2 |  * cancel all jobs
 | 
 | 3 |  *
 | 
 | 4 |  */
 | 
 | 5 | export async function main(workspace: string) {
 | 
 | 6 |   const url = new URL(`${BASE_URL}/api/w/${workspace}/jobs/queue/cancel_all`);
 | 
 | 7 | 
 | 
 | 8 |   const response = await fetch(url, {
 | 
 | 9 |     method: "POST",
 | 
 | 10 |     headers: {
 | 
 | 11 |       Authorization: "Bearer " + WM_TOKEN,
 | 
 | 12 |     },
 | 
 | 13 |     body: undefined,
 | 
 | 14 |   });
 | 
 | 15 |   if (!response.ok) {
 | 
 | 16 |     const text = await response.text();
 | 
 | 17 |     throw new Error(`${response.status} ${text}`);
 | 
 | 18 |   }
 | 
 | 19 |   return await response.json();
 | 
 | 20 | }
 | 
 | 21 | 
 |