//native
type Attio = {
token: string;
};
/**
* Delete a comment
* Deletes a comment by ID. If deleting a comment at the head of a thread, all messages in the thread are also deleted.
Required scopes: `comment:read-write`.
*/
export async function main(auth: Attio, comment_id: string) {
const url = new URL(`https://api.attio.com/v2/comments/${comment_id}`);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 51 days ago