//native
type Clickup = {
token: string;
};
/**
* Update Comment
* Replace the content of a task commment, assign a comment, and mark a comment as resolved.
*/
export async function main(
auth: Clickup,
comment_id: string,
body: {
comment_text: string;
assignee: number;
group_assignee?: number;
resolved: false | true;
},
) {
const url = new URL(`https://api.clickup.com/api/v2/comment/${comment_id}`);
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