Edits history of script submission #14710 for ' Delete Space Tag (clickup)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Clickup = {
      token: string;
    };
    /**
     * Delete Space Tag
     * Delete a task Tag from a Space.
     */
    export async function main(
      auth: Clickup,
      space_id: string,
      tag_name: string,
      body: { tag: { name: string; tag_fg: string; tag_bg: string } },
    ) {
      const url = new URL(
        `https://api.clickup.com/api/v2/space/${space_id}/tag/${tag_name}`,
      );
    
      const response = await fetch(url, {
        method: "DELETE",
        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