//native
type Clickup = {
token: string;
};
/**
* Add tags from time entries
* Add a label to a time entry.
*/
export async function main(
auth: Clickup,
team_id: string,
body: {
time_entry_ids: string[];
tags: { name: string; tag_fg: string; tag_bg: string }[];
},
) {
const url = new URL(
`https://api.clickup.com/api/v2/team/${team_id}/time_entries/tags`,
);
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 168 days ago