//native
type Clickup = {
token: string;
};
/**
* Create Space Tag
* Add a new task Tag to a Space.
*/
export async function main(
auth: Clickup,
space_id: 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`);
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