//native
type Smartsheet = {
token: string;
baseUrl: string;
};
/**
* Edit a comment
* Updates the text of a comment. NOTE: Only the user that created the comment is permitted to update it.
*/
export async function main(
auth: Smartsheet,
sheetId: string,
commentId: string,
body: { text?: string },
) {
const url = new URL(
`${auth.baseUrl}/sheets/${sheetId}/comments/${commentId}`,
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + 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