//native
type Clickup = {
token: string;
};
/**
* Create List Comment
* Add a comment to a List.
*/
export async function main(
auth: Clickup,
list_id: string,
body: { comment_text: string; assignee: number; notify_all: false | true },
) {
const url = new URL(`https://api.clickup.com/api/v2/list/${list_id}/comment`);
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