Edits history of script submission #23677 for ' Delete Task (asana)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Delete Task
     * Delete a task. It moves to the trash of the user who ran the deletion and can be recovered from there for 30 days.
     */
    export async function main(auth: RT.Asana, task_gid: string) {
      const response = await fetch(
        `https://app.asana.com/api/1.0/tasks/${task_gid}`,
        {
          method: "DELETE",
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/json",
          },
        }
      )
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 3 hours ago