Edits history of script submission #14663 for ' Add Task To List (clickup)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Clickup = {
      token: string;
    };
    /**
     * Add Task To List
     * Add a task to an additional List. \
     \
    ***Note:** This endpoint requires the [Tasks in Multiple List ClickApp](https://help.clickup.com/hc/en-us/articles/6309958824727-Tasks-in-Multiple-Lists) to be enabled.*
     */
    export async function main(auth: Clickup, list_id: string, task_id: string) {
      const url = new URL(
        `https://api.clickup.com/api/v2/list/${list_id}/task/${task_id}`,
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          Authorization: auth.token,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago