Edits history of script submission #14677 for ' Create List (clickup)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Clickup = {
      token: string;
    };
    /**
     * Create List
     * Add a new List to a Folder.
     */
    export async function main(
      auth: Clickup,
      folder_id: string,
      body: {
        name: string;
        content?: string;
        markdown_content?: string;
        due_date?: number;
        due_date_time?: false | true;
        priority?: number;
        assignee?: number;
        status?: string;
      },
    ) {
      const url = new URL(
        `https://api.clickup.com/api/v2/folder/${folder_id}/list`,
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: auth.token,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago