Edits history of script submission #14665 for ' Change tag names from time entries (clickup)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Clickup = {
      token: string;
    };
    /**
     * Change tag names from time entries
     * Rename an time entry label.
     */
    export async function main(
      auth: Clickup,
      team_id: string,
      body: { name: string; new_name: string; tag_bg: string; tag_fg: string },
    ) {
      const url = new URL(
        `https://api.clickup.com/api/v2/team/${team_id}/time_entries/tags`,
      );
    
      const response = await fetch(url, {
        method: "PUT",
        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