Edits history of script submission #22744 for ' Complete Task (outreach)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Complete Task
     * Marks a task as complete.
     */
    export async function main(auth: RT.Outreach, task_id: number) {
      const response = await fetch(
        `https://api.outreach.io/api/v2/tasks/${task_id}/actions/markComplete`,
        {
          method: "POST",
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/vnd.api+json",
          },
        }
      )
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 5 hours ago